A: x=1,y=0
B: x=4,y=25
C: x=5,y=30
D: 输出其他结果
举一反三
- 有如下事件程序,运行该程序后输出结果是。 Private Sub Command33_Click() Dim x As Integer, y As Integer x = 1: y = 0 Do Until y <= 25 y = y + x * x x = x + 1 Loop MsgBox "x=" & x & ", y=" & y End Sub
- 编写如下程序: Private Sub Command1_Click() Dim x As Integer, y As Integer x = 1: y = 1 Do y = x * y If y > 10 Then Print x, y Exit Do Else x = x + 3 End If Loop While x <= 10 End Sub 运行程序,输出结果为______
- 以下程序运行后的输出结果是 ______。 Sub add(x,y) x=x+y Print "x=";x;",y=";y End Sub Private Sub Command1_Click() x=1 y=1 Call add((x),(y)) Print"x="; x;",y=";y End Sub A: x=1,y=1 B: x=2,y=2 C: x=2,y=1 D: x=1,y=1 E: x=1,y=1 F: x=1,y=1 G: x=2,y=1 H: x=2,y=1
- 中国大学MOOC: 下面的程序执行完后a,b的值分别为______。 Dim x, y, a, b As Integer x = 12 : y = 8 a = 1 : b = x * y Do While x Mod 2 = 0 And y Mod 2 = 0 x = x 2 y = y 2 a = a * 2 Loop Do While x <> y If x > y Then x = x - y Else y = y - x End If Loop a = a * x b = b a
- 下面程序运行后,点击窗体,变量 x和y的值分别为( )、( ) Private Sub Form_Click() Dim x, y As Integer x = 5: y = 10 nc x, y Print "x="; x; "y="; y End Sub Private Sub nc(ByVal a%, b%) a = a + b b = a a = a * b End Sub
内容
- 0
Sub s1(ByVal x As Integer, ByVal y As Integer) Dim t As Integer t = x: x = y: y = t End Sub Sub s2(x As Integer, y As Integer) Dim t As Integer t = x: x = y: y = t End Sub 则以下说法中正确的是( )。
- 1
完成以下功能:计算分段函数完成程序。 x2+1 (x<0) y= 2x+1 (0≤x<1) 3x3 (x≥1) Private Sub Command1_Click() Dim y As Single, x As Single x = InputBox("请输入x的值") If x() Then y = x * x + 1 () x < 1 Then y = 2 * x + 1 Else y = 3 * x ^ 3 End If Print x; y End Sub
- 2
如下程序的运行结果是( ) intx=1,y=1;if(x==1) y=x+1;elseif(y==2) x=y+1;else y=0; A: x=1, y=2 B: x=3, y=2 C: x=3, y=0 D: x=1, y=0
- 3
【单选题】下面的程序执行完后a,b的值分别为______。 Dim x, y, a, b As Integer x = 12 : y = 8 a = 1 : b = x * y Do While x Mod 2 = 0 And y Mod 2 = 0 x = x 2 y = y 2 a = a * 2 Loop Do While x <> y If x > y Then x = x - y Else y = y - x End If Loop a = a * x b = b a A. 4 24 B. 24 4 C. 4 12 D. 8 24
- 4
写出下列程序的运行结果。 Private Sub Form_Click() Dim x%, y% x = InputBox("请输入一个整数") If x <= 30 And x > 10 Then If x > 20 Then If x < 25 Then y = 10 Else y = 20 End If Else If x > 15 Then y = 30 Else y = 50 End If End If End If Print y End Sub 假设输入18,则运行结果为