![[填空题] 有一过程如下: Sub Subl (m As Integer,total As Long) Dim i AS Integer total = 1 For i = 1 To,第1张 [填空题] 有一过程如下: Sub Subl (m As Integer,total As Long) Dim i AS Integer total = 1 For i = 1 To,第1张](/aiimages/%5B%E5%A1%AB%E7%A9%BA%E9%A2%98%5D+%E6%9C%89%E4%B8%80%E8%BF%87%E7%A8%8B%E5%A6%82%E4%B8%8B%EF%BC%9A+Sub+Subl+%28m+As+Integer%2Ctotal+As+Long%29+Dim+i+AS+Integer+total+%3D+1+For+i+%3D+1+To.png)
[填空题] 有一过程如下:
Sub Subl (m As Integer,total As Long)
Dim i AS Integer
total = 1
For i = 1 To m
total = total * i
Next
End Sub
调用它的事件过程如下:
Private Sub Commandl_Click( )
Dim tot As Long, a As Integer
a = Val( InputBox ("请输入数据")
Call Subl (a,tot)
Print tot
End Sub
则输入数据5,运行结果为 【10】 。
正确答案:120
参考解析:本题的难点是实参与形参的传递的问题。 total按ByRef参数传递。子过程的功能是计算n!,题中输入5,因此51=120。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)