阅读程序,写出程序运行结果:
Private Sub Command1_Click() Dim x As Integer, y As Integer x = 1
Do While x <= 4 y = y + x x = x + 1 Print y Loop End Sub
Private Sub Command2_Click() Dim s!
s = qnj(3, 4, 5) Print s End Sub
Function qnj(a!, b!, c!) As Single Dim p!
p = (a + b + c) / 2
qnj = Sqr(p * (p - a) * (p - b) * (p - c)) Print a, b, c End Function
1
Private Sub Command3_Click() Dim a%, b% b = Int(Rnd) a = b + 5 Print b, a Select Case a Case 5
Print \优秀\ Case 4 Print \良\ Case 3
Print \通过\ Case Else Print \未通过\ End Select Print a ^ b End Sub
2
Private Sub Command4_Click() Dim x As Single, y As Single For x = 5 To 20 Step 5 If x < 0 Then y = x ^ 2 - 1 Print y
ElseIf x < 10 Then y = x ^ 2 Print y
ElseIf x < 20 Then y = x ^ 2 + 1 Print y
ElseIf x < 30 Then y = x ^ 3 + x + 1 Else
y = x ^ 2 - 10 Print y End If Next x Print x End Sub
3
Private Sub Command5_Click() For i = 1 To 3 x = 4
For j = 1 To 2 x = x + 1 Next j Print x Next i Print i End Sub
Private Sub Command6_Click() n = 0
For i = 1 To 3
For j = 5 To 1 Step -1 n = n + 1 Next j Print n Next i Print i End Sub
4
Private Sub Command7_Click() Dim a As Integer, b As Integer a = 3 b = 5
Print a + b, a - b, a & b, a * b End Sub
Private Sub Command8_Click()
Dim a As Integer, b As Integer, c As Integer, d As Integer
Dim p As Single, q As Single, r As Single, m As Single
a = 2 b = 3 c = 4 d = 5
Call jch(a, p) Call jch(b, q) Call jch(c, r) Call jch(d, m) Print p, q, r, m End Sub
5