阅读下面程序: Private Function a(load As Integer) As Single If load <20 then money = load/2 else money =20 + load end if a = money End

admin2009-01-19  24

问题 阅读下面程序:
Private Function a(load As Integer) As Single
If load <20 then
money = load/2
else
money =20 + load
end if
a = money
End Function
Private Sub Form_Click( )
Dim load As Integer, fee As Single
Load = InputBox("请输入一个数:")
fee= a(loa@D@Print fee
End Sub
输入20,运行后的输出结果是【  】。

选项

答案40

解析 本题调用通用函数过程,进行虚实结合后load的值为20。执行a函数时,首先判断 load<20条件为假,执行money=20+load,使money的值为40。接着执行a=money语句,使函数名的值为40,执行到语句End Function则返回调用它的事件过程,将函数值赋给变量fee。最后输出变量fee的值,其值为40。
转载请注明原文地址:https://kaotiyun.com/show/q35p777K
0

相关试题推荐
最新回复(0)