举一反三
- 中国大学MOOC: 下列程序的输入值为5,运行结果为( )。Private Sub Command1_Click() Dim a As Integer a = InputBox("请输入a的值") Select Case a Case 1 To 4 Print "D" Case 5 To 10 Print "C" Case 11 To 14 Print "B" Case Else Print "A" End SelectEnd Sub
- 编写如下程序: Private Sub Command1_Click; Dim m As Integer, n As Integer m = 2 : n = 1 Select Case m Case 1 Select Case n Case 1 Print "AAA" Case 2 Print "BBB" End Select Case 2 Print "CCC" End Select End Sub 程序运行后,单击命令按钮Command1,输出结果为 A: BBB B: CCC C: AAA D: 1
- 中国大学MOOC: 有如下程序:Private Sub Command1_Click() xcase = 1 t = InputBox("请输入一个数:") Select Case t Case Is > 0 y = xcase + 1 Case Is = 0 y = xcase + 2 Case Else y = xcase + 3 End Select Print xcase; yEnd Sub程序运行时,在对话框中输入-1,则显示的结果为( )。
- 中国大学MOOC: 在窗体上添加一个命令按钮Command1和两个文本框Text1和Text2,然后编写如下事件过程:Private Sub Command1_Click() n = Text1.Text Select Case n Case 1 To 20 x = 10 Case 2, 4, 6 x = 20 Case Is < 10 x = 30 Case 10 x = 40 End Select Text2.Text = xEnd Sub程序运行后,如果在文本框Text1中输入10,然后单击命令按钮,则在Text2中显示的内容是( )。
- 在窗体中添加一个命令按钮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 运行后,单击命令按钮,则在窗体上显示的是( )。
内容
- 0
在窗体上添加一个命令按钮Command1,然后编写如下事件过程: Private Sub Command1_Click() For i = 1 To 4 x = 4 For j = 1 To 3 x = 3 For k = 1 To 2 x = x + 6 Next k Next j Next i Print x End Sub 程序运行后,单击命令按钮,显示结果为( )。
- 1
在窗体中添加一个命令按钮 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 ,然后单击“确定”按钮,程序的运行结果为( )。
- 2
在窗体上画一个名称为Command1的命令按钮,然后编写如下事件过程: Private Sub Command1_Click() a=1:b=2:c=3 a=b:b=c:c=a Print a;b;c End Sub 程序运行后,单击命令按钮,则窗体上显示的内容是().
- 3
中国大学MOOC: 在窗体上添加一个命令按钮Command1,然后编写如下事件过程:Private Sub Command1_Click() For n = 1 To 20 If n Mod 3 <> 0 Then m = m + n \ 3 Next n Print nEnd Sub程序运行后,如果单击命令按钮,则窗体上显示的内容是( )。
- 4
设有如下窗体单击事件过程,则窗体运行后,单击窗体,消息框输出的结果是______。 Private Sub Form_Click() a=1 For i=1 To 3 Select Case i Case 1,3 a=a+1 Case 2,4 a=a+2 End Select Next i MsgBox End Sub