下列程序执行后,变量x的值为( )。 Private Sub command1_click() Dim a, b, c, d As Single Dim x As Single a = 100: b = 20: c = 1000 If b > a Then d = a: a = b: b = d End If If b > c Then x = b ElseIf a > c Then x = c Else x = a End If End Sub
举一反三
- 下列程序执行后,变量x的值为______。 Dim a, b, c, d As Single Dim x As Single a=100 b=20 c=1000 If b>a Then d=a: a=b: b=d End If If b>c Then x=b Elseif a>c then x=c Else x=a End If A: 100 B: 20 C: 1000 D: 0
- 下列程序执行后,变量x的值为( )。 Dim a,b,c,d As Single Dim x As Single a=100 b=20 c=1000 If b>a Then d=a:a=b:b=d End If If b>c Then x=b Elseif a>c Then x=c Else x=a End If A: A) 100 B: B) 20 C: C) 1000 D: D) 0
- 完成以下功能:计算分段函数完成程序。 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
- 设有如下两个过程: 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 运行程序后, 则输出结果是________
- 如下程序的运行结果是【1】. Private Sub Command1_Click() Dim x As Integer x = 12 f2 x Print x End Sub Public Sub f2(n As Integer) n = n Mod 10 End Sub