万能百科  > 计算机   > 

[单项选择题] 以下用户自定义函数 Function Func(a As Integer, b As Integer) As Integer Stati

2021-07-20   

[单项选择题] 以下用户自定义函数

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的计算过程为i=2+0+1 =3,变量m的计算过程为m=3+4+1=8,m的值通过于函数名Fune返回。

词条内容仅供参考,如果您需要解决具体问题
(尤其在法律、医学等领域),建议您咨询相关领域专业人士。

标签