问题
填空题
阅读下面程序:
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(loaD)
Print fee
End Sub
输入20,运行后的输出结果是 【6】 。
答案
参考答案:40
解析: 本题调用通用函数过程,进行虚实结合后load的值为20。执行a函数时,首先判断 load<20条件为假,执行money=20+load,使money的值为40。接着执行a=money语句,使函数名的值为40,执行到语句End Function则返回调用它的事件过程,将函数值赋给变量fee。最后输出变量fee的值,其值为40。