• 2021-04-14
    设有下面程序
    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 ,则输出的结果是________
  • 2 5 9

    举一反三

    内容

    • 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