问题
单项选择题
以下用户自定义函数 Function Func(a As Integer,b As Integer) As Integer Static m As Integer,i As Integer m=0:i=2 i=i+m+i m=i+a+b Func=m End Function 在窗体上画一个命令按钮,然后编写如下事件过程: Private Sub Command1_Click() Dim k As Integer,m As Integer,p As Integer k=4:m=1 P=Func(k,m) Print p End Sub 程序运行后,单击命令按钮,输出结果为
A.8
B.9
C.10
D.11
答案
参考答案:A
解析: 变量;的计算过程为i=2+0+1=3,变量m的计算过程为m=3+4+1=8,m的值通过子函数名Fun c返回。