编写如下程序: Private Sub Command1_Click() Dim n As Integer : Static s As Integer For n = 1 To 3 s = s + n Next Print s End Sub 程序运行后,第三次单击命令按钮Command1时,输出结果为
举一反三
- 编写如下程序: 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
- 有如下事件过程 Private Sub Command1_Click() S=P(1)+P(2)+P(3)+P(4) Print S End Sub Public Function P(n As Integer) Static sum For i=1 To n sum=sum+i Next I P=sum End Function 单击命令按钮后,程序执行的结果是
- 运行下列程序,单击窗体显示的结果为( )。 Private Sub Form_Click() Dim a Dim s As Integer, i As Integer a = Array(1, 2, 3) For i = 2 To 0 Step -1 s = s + a(i) * a(i) Next i Print s End Sub
- 中国大学MOOC: 在窗体上添加一个命令按钮Command1,然后编写如下事件过程:Private Sub Command1_Click() Dim a As Integer, s As Integer a = 8 s = 1 Do s = s + a a = a - 1 Loop While a <= 0 Print s; aEnd Sub程序运行后,单击命令按钮,则窗体上显示的内容是( )。
- 编写如下程序: Private Sub Command1_Click() Dim score As Integer score = 90 If score > 80 Then r = 5 ElseIf score > 60 Then r = 3 Else r = 1 End If Print r End Sub 程序运行后,单击命令按钮Command1,输出结果为(______)。