写出下列程序的运行结果。 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,则运行结果为
举一反三
- 编写如下程序: 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 运行程序,输出结果为______
- 执行下列事件过程,y的值为。 Private Sub Command1_Click() x = 3 If x > 10 Then y = x ^ 2 + 3 * x + 2 Else If x > 5 Then y = 3 * x + 2 Else y = 5 End If End If End Sub
- 下面程序运行后,点击窗体,变量 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
- 设有如下两个过程: Private Sub Form_Click() Dim x!,y! x = 18: y = 10 Call PPP((x), y) Print x,y End Sub Private Sub PPP(a As Single, b As Single) a = a + b Print a,b b = a + b Print a,b End Sub 运行程序后, 则输出结果是________
- 完成以下功能:计算分段函数完成程序。 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