• 2021-04-14
    在窗体中添加一个命令按钮Command1,编写如下代码: Private Sub Command1_Click() x = 6 If x > 6 Then If x = 6 Then Print "a" Else Print "b" End If Else If x < 8 Then Print "c" Else If x = 6 Then Print "d" End If End If End If End Sub 运行后,单击命令按钮,则在窗体上显示的是( )。
  • c

    举一反三

    内容

    • 0

      设窗体上有一个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

    • 1

      已知一窗体中有如下函数过程和一命令按钮Command1,则单击Command1时,输出结果为。 Public Function Fn(n) If n = 0 Then Fn = 1 Else Fn = Fn(n - 1) * n End Function Private Sub Command1_Click() Print Fn(6) End Sub

    • 2

      运行如下程序,输出结果是 。 try: x, y = 1, 0 z = x / y print(0, end=",") except: print("1", end=",") else: print("2", end=",") finally: print("3", end=",")

    • 3

      在窗体中添加一个命令按钮 Command1 , 并编写如下程序 : Private Sub Command1_Click() x = InputBox(x) If x ^ 2 = 9 Then y = x If x ^ 2 < 9 Then y = 1 / x If x ^ 2 > 9 Then y = x ^ 2 + 1 Print y End Sub 程序运行时,单击命令按钮,在 InputBox 中输入 3 ,然后单击“确定”按钮,程序的运行结果为( )。

    • 4

      在窗体中添加一个命令按钮(名为Command1),然后编写如下代码: Public x as integer Private Sub Command1_Click( ) a=10 Call s1 Call s2 MsgBox x End Sub Private Sub s1( ) x=x+20 End Sub Private Sub s2( ) Dim x as integer x=x+20 End Sub 窗体打开运行后,单击命令按钮,则消息框的输出结果是______。 A: 10 B: 30 C: 40 D: 50