Sub inc(a As Integer)
Static x As Integer
x = x + a
Print x;
End Sub
Private Sub Form_Click()
inc 2
inc 3
inc 4
End Sub
程序运行后,单击命令按钮 Command1 ,则输出的结果是________
举一反三
- 在窗体上画一个命令按钮,然后编写如下程序: Dim x As Integer Sub inc(a As Integer) x=x+a End Sub Private Sub Command1_CliCk() inc2 inc3 inc4 Msgbox x; End Sub 程序执行后,单击Command1命令按钮,消息框显示结果是 【14】
- 设窗体上有一个Command1命令按钮,还有以下程序代码: Private Sub Command1_Click() Static x As Integer x=x+1 Call proc(x) Print x, End Sub Private Sub proc(a As Integer) Static x As Integer x=x+a:a=x End Sub 程序运行后,3次单击命令按钮,则产生的输出是 A: 1 2 3 B: 1 3 5 C: 1 3 7 D: 2 4 6
- 在窗体上画一个命令按钮,然后编写如下程序: Private Sub Comrnand3_Click( ) Cop 2 Cop 3 Cop 4 End Sub Sub Cop (a As Integer) Static x As Integer x=x + a Print x; End Sub 程序运行后,单击命令按钮,输出结果为 A: 2 3 4 B: 2 5 9 C: 3 5 4 D: 2 4 3
- 在窗体中添加一个名称为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 Comrnand3_Click( ) Cop 2 Cop 3 Cop 4 End Sub Sub Cop (a As Integer) Static x As Integer x=x + a Print x; End Sub 程序运行后,单击命令按钮,输出结果为( )。 A: 内联函数 B: 重载函数 C: 递归函数 D: 嵌套函数
内容
- 0
在窗体上画一个命令按钮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 运行窗体后,单击命令按钮,则消息框的输出结果为______。
- 1
在窗体中添加一个命令按钮(名为Command1),然后编写如下代码: Public x as integer Private Sub Command1_Click( ) x=5 Call s1 Call s2 MsgBox x End Sub Private Sub s1( ) x=x+10 End Sub Private Sub s2( ) Dim x as integer x=x+10 End Sub 窗体打开运行后,单击命令按钮,则消息框的输出结果是______
- 2
如下程序的运行结果是【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
- 3
运行下面的程序,第二行显示结果是___________。 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
- 4
执行下列程序后,鼠标单击窗体,输出结果为( )。 Private Sub Form_Click() Print "Click"; End Sub Private Sub Form_MouseDown(Button As Integer, Shift A: As Integer,X As Single,Y As Single) B: Print "Down" C: End Sub D: Private Sub Form_MouseUp(Button As Integer, Shift_As Integer,X As Single,Y As Single) E: Print "Up" F: End SubA) DownUpClick G: B) ClickDownUp H: C) DownClickUp I: D) UpDownClick