如下程序的运行结果是【1】.
Private Sub Command1_Click()
Dim x As Integer
x = 12
f2 x
Print x
End Sub
Public Sub f2(n As Integer)
n = n Mod 10
End Sub
Private Sub Command1_Click()
Dim x As Integer
x = 12
f2 x
Print x
End Sub
Public Sub f2(n As Integer)
n = n Mod 10
End Sub
举一反三
- 运行下面的程序,第二行显示结果是___________。 Private Sub Form_Click() Dim A As Integer Dim i As Integer A = 5 For i = 1 To 9 Call sub1(i, A) Print i, A Next i End Sub Private Sub sub1(x As Integer, y As Integer) Static N As Integer Dim I As Integer For I = 3 To 1 Step -1 N = N + x x = x + 2 Next I y = y + N End Sub
- 在窗体上画一个命令按钮Command1,编写事件代码如下: Public x As Integer Private Sub Command1_Click() x=3 Call f1 Call f2 MsgBox x End Sub Private Sub f1() x=x*x End Sub Private Sub f2() Dim x As Integer x=x+4 End Sub 运行窗体后,单击命令按钮,则消息框的输出结果为______。
- 编写如下程序: Private Sub Command1_Click() Dim x As Integer, y As Integer x = 1: y = 1 Do y = x * y If y > 10 Then Print x, y Exit Do Else x = x + 3 End If Loop While x <= 10 End Sub 运行程序,输出结果为______
- 窗体上有一个名称为Command1的命令按钮,其中部分代码如下:Private Sub Command1_Click()Dim a(10)As IntegerDim n As Integer……Call calc(a,n)……End Subcalc过程的首行应该是()。 A: Sub calc(x() As Integer, n As Integer) B: Public Sub calc(x() As Integer) C: Private Sub calc(a(n) As Integer, n As Integer) D: Public Sub calc(a As Integer, n As Integer)
- 在窗体中添加一个名称为Command1的命令按钮,然后编写如下程序: Public x As Integer Private Sub Command1______Click() x=3 Call f1 Call f2 MsgBox x End Sub Private Sub f1() x=x*x End Sub Private Sub f2() Dim x As Integer x=x+4 End Sub 窗体打开运行后,单击命令按钮,则消息框的输出结果为______。