中国大学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,然后编写如下事件过程: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,则窗体上显示的是( )。
- 中国大学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
- 下列程序段的执行结果为a=1b=0Select Case a Case 1 Select Case b Case 0 Print"**0**" Case 1 Print"**1**" End SelectCase 2 Print"**2**"End Select A.* * 0 * * B.* * 1 * * C.* * 2 * * D.0
- 下列程序的输出结果是 。 Private Sub exam1() 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 a End Sub