问题
填空题
Sub subl(x As Single, ByVal y As Single)
t=x
x=t/y
y=t Mod y
End Sub
Private Sub Form_Click()
Dim a As Single
Dim b As Single
a=5
b=4
sub1 a,b
Print "a=";a,"b=";b
End Sub
程序运行后,单击命令按钮,则a= (6) ,b= (7) 。
答案
参考答案:D
解析: sub1子过程中,x默认为地址传递,y被定义为传值传递,即y值的变动不会改变原来变量的值,所以Form_Click中b的值保持4不变。传入"a=5,b=4"。t=5,x=5/4,故x=1.25;y=5%4,故y=1。最后结果为a=1.25,b=4。