中国大学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: 在窗体上添加一个命令按钮Command1,然后编写如下事件过程:Private Sub Command1_Click() x = InputBox(Input) Select Case x Case 1, 3 Print 分支 1 Case Is > 4 Print 分支 2 Case Else Print Else 分支 End SelectEnd Sub程序运行后,如果在输入对话框中输入2,则窗体上显示的是( )。
- 下列程序段的运行结果为( )。 Dim x x = Int(Rnd) + 5 Select Case x Case 5 Print "优秀" Case 4 Print "良好" Case 3 Print "及格" Case Else Print "不及格" End Select
- 中国大学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,则显示的结果为( )。
- 下列程序的运行结果为( )。 Private Sub Command1_Click() Score = Int(Rnd * 10) + 80 Select Case Score Case ls < 60 a$ = "E" Case 60 To 69 a$ = "D" Case 70 To 79 a$ = "C" Case 80 To 89 a$ = "B" Case Else a$ = "A" End Select Print a$ End Sub