例如:有循環(huán):for I=n1 to n2 step n3 下列哪些語句會影響循環(huán)次數(shù)( )
A. n1=n1+I
B. n3=2*n3
C. n2=n2+n3
D. I=I+n3
2、Do------Loop (While,Until)
例如:運(yùn)行下面的程序,單擊窗體后在窗體上的內(nèi)容是( );若將程序中的A語句與B語句的位置互換,再次執(zhí)行程序,單擊窗體后在窗體上顯示的內(nèi)容是( )
Private Sub Form_Click()
Dim a As Integer, b As Integer
a = 0: b = 0
Do While a <= 8
a = a + 2 'A語句
b = b + a * a 'B語句
Loop
Print a, b
End Sub
例如:窗體上顯示的結(jié)果:
Private Sub Form_Click()
Dim p As Integer, i As Integer, n As Integer
p = 2: n = 20
For i = 1 To n Step p
p = p + 2
n = n - 3
i = i + 1
If p >= 10 Then Exit For
Next i
Print i, p, n
End Sub
一、 InputBox函數(shù)
MsgBox函數(shù) (注意參數(shù)含義及順序)
x=InputBox(_____,______,_______)
寫出顯示下圖信息框的MsgBox函數(shù)