[单项选择题] 现有如下程序: Private Sub Command1_Click() s=0 Fori=1 To 6 s=s+f(5+i) Nex
2021-07-20
[单项选择题] 现有如下程序:
Private Sub Command1_Click()
s=0
Fori=1 To 6
s=s+f(5+i)
Next
Print s
End Sub
Public Function f(x As Integer)
If x>=8 Then
t=x+2
Else
t=x+1
End If
f=t
End Function
运行程序,则窗体上显示的是______。
A. 38
B. 49
C. 61
D. 70
正确答案:C
参考解析:[Public|Private][Static] Function函数名([<参数列表>])[As<类型>] <局部变量或常数定义> <语句块> [函数名=返回值] [Exit Function] <语句块> [函数名=返回值] End Function 题干的程序通过Command1的Click事件,调用过程函数f(x),得出结果为61。
词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。