下列程序运算后,Label1结果显示的是:
Dim x As Integer
Dim S As String
x = 20
S = "2020"
x = x Mod 3
Select Case x
Case 0
Label1.Text = "A"
Case 1
Label1.Text = "B"
Case 2
Label1.Text = "C"
Case Else
Label1.Text = "D"
End Select
Dim x As Integer
Dim S As String
x = 20
S = "2020"
x = x Mod 3
Select Case x
Case 0
Label1.Text = "A"
Case 1
Label1.Text = "B"
Case 2
Label1.Text = "C"
Case Else
Label1.Text = "D"
End Select
举一反三
- 设有下面的语句:Print IIf(x>0, 1, IIf(x<0,-1, 0))与此语句输出结果不同的程序段是______。 A: If x>0 Then x=1 ElseIf x<0 Then x=-1 End If Print x B: If x>0 Then Print 1 ElseIf x<0 Then Print-1 Else Print 0 End If C: Select Case x Case Is>0 Print 1 Case Is<0 Print-1 Case Else Print 0 End Select D: If x<>0 Then If x>0 Then Print 1 ElseIf x<0 Then Print-1 Else Print 0 End If
- 下列程序段的运行结果为( )。 Dim x x = Int(Rnd) + 5 Select Case x Case 5 Print "优秀" Case 4 Print "良好" Case 3 Print "及格" Case Else Print "不及格" End Select
- 执行下列程序段后,变量 x 的值为( )。 x = 12select case x\10 case 1 x = 1 case 2 x = 2end select A: 1 B: 2 C: 12 D: 出错
- 编写如下程序: 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
- 以下程序段中,执行结果与其他3个选项不同的是 A: Dim y As Integer B: y = 11 C: Select Case y D: Case 15 To 5 E: Print "Executed" F: End Select G: Dim y As Integer H: y = 10 I: Select Case y J: Case Is > 10, Is < 10 K: Print " Executed " L: End Select M: Dim y As Integer N: y = 10 O: Select Case y P: Case Is > 15, 1, 5 To 8 Q: Print " Executed " R: End Select S: Dim y As Integer T: y = 10 U: Select Case y V: Case 1, 3, Is > 6 W: Print " Executed " X: End Select