在窗体上有1个名称为Command1的命令按钮,并有如下事件过程和函数过程:
Private Sub Command1_Click()
Dim p As Integer
p = m(1) + m(2) + m(3)
Print p
End Sub
Private Function m(n As Integer) As Integer
Static s As Integer
For k = 1 To n
s = s + 1
Next
m = s
End Function
运行程序,单击命令按钮Commandl后的输出结果为 ______ 。
发布于 2022-05-11 10:17:49
登录后免费查看答案
关注者
0
被浏览
16
1 个回答
推荐阅读
-
在窗体上画一个名称为Command1的命令按钮,然后编写如下通用过程和命令按钮的事件过程:Private Function f(m As Integer)If m Mod 2 = 0 Thenf = mElsef = 1End IfEnd FunctionPrivate Sub Command1_Click()Dim i As Integers = 0For i = 1 To 5s = s + f(i)NextPrint sEnd Sub程序运行后,单击命令按钮,在窗体上显示的是
2022-05-11 关注 0 浏览17 1答案
-
在窗体上画一个名称为Command1的命令按钮,然后编写如下通用过程和命令按钮的事件过程:Private Function fun(ByVal m As Integer)If m Mod 2 = 0 Thenfun = 2Elsefun = 1End IfEnd FunctionPrivate Sub Command1_Click()Dim i As Integer, s As Integers = 0For i = 1 To 5s = s + fun(i)NextPrint sEnd Sub程序运行后,单击命令按钮,在窗体上显示的是( )。
2022-05-11 关注 0 浏览9 1答案
-
窗体上命令按钮Command1的事件过程如下:Private Sub Command1_Click() Dim total As Integer total = s(1)+s(2) Print totalEnd SubPrivate Function s(m As Integer) As Integer Static x As Integer For i =1 To m x=x+1 Next i S=xEnd Function运行程序,第3次单击命令按钮Command1时,输出结果为 ______
2022-05-11 关注 0 浏览17 1答案
-
在窗体上画一个命令按钮,其名称为Command1,然后编写如下程序:Function M(x As Integer,y As Integer)As IntegerM=IIf(x>y,x,y)End FunctionPrivate Sub command1_Click()Dim a As Integer,b As Integera=100b=200Print M(a,b)End Sub 程序运行后,单击命令按钮,输出结果为______ 。
2022-05-11 关注 0 浏览19 1答案
-
在窗体上画1个命令按钮,并编写如下事件过程:Private Sub Command1_Click()Dim a(3,3)For m=1 To 3For n=1 To 3If n=m Or n=4-m Thena(m,n)=0End IfPrint a(m,n);Next nPrintNext mEnd Sub运行程序,单击命令按钮,窗体上显示的内容为
2022-05-11 关注 0 浏览10 1答案
-
在窗体上画1个命令按钮,并编写如下事件过程:Private Sub Command1_Click()Dim a(3,3)For m=1 To 3For n=1 To 3If n=m or n=4-m Thena(m,n)=m+nElsea(m,n)=0End IfPrint a(m,n);Next nPrintNext mEnd Sub运行程序,单击命令按钮,窗体上显示的内容为( )。
2022-05-11 关注 0 浏览16 1答案
-
有下列函数过程:Function Func2(a As Integer ,b As Integer)As IntegerStatic m As Integer ,i As Integerm=0i =2a=i +m+1b =i +a+bFunc2=mEnd Function在窗体上画一个命令按钮,然后编写下列事件过程:Private Sub Co mmandl_Click()Di m P As Integer ,k As Integer ,m As Integerk =4m=1P=Func2(k ,m)Print k ;mP=Func2(km)Print k =m End Sub程序运行后,单击命令按钮,输出结果是( )。
2022-05-11 关注 0 浏览16 1答案
-
在窗体上画1个命令按钮,其名称为Command1,然后编写如下程序:Private Sub Command1_Click()Dim a(10)As IntegerDim x As IntegerFor i=1 To 10a(i)=8+iNextx=2Print a(f(x)+x)End SubFunction f(x As Integer)x=x+3f=xEnd Function程序运行后,单击命令按钮,输出结果为。
2022-05-11 关注 0 浏览13 1答案
-
阅读下列程序:Private Sub Command1_Click()Dim i As Integer, k As Integerk=2For i=1 To 3Print H(k) ;Next iEnd SubFunction H(j As Integer)a=0Static ba=a + 1b=b + 1H=a*b + jEnd Function程序运行后,单击命令按钮输出结果是
2022-05-11 关注 0 浏览18 1答案
-
单击一次命令按钮后,下列程序的执行结果是Private Sub Command1_Click()s=P(1) + P(2) + P(3) + P(4)Print sEnd SubPublic Function P(N As Integer)Static SumFor i=1 To NSum=Sum + iNext iP=SumEnd Function
2022-05-11 关注 0 浏览13 1答案