诸位大侠,在下不才,请告诉我程序的运行流程好吗?
寒假复习VB准备考二级,看书的时候做课后习题遇到困难了。执行下面程序,当单击窗体时,输出的结果是什么?
Private Sub Form_click()
Dim I As Integer, k As Integer
Dim a1 As Integer, a2 As Integer, a3 As Integer
a1 = 1: a2 = 10: a3 = 2
For I = a1 To a2 Step a3
k = k + 1
I = I + 2
a1 = a1 + 1
a2 = a2 - 5
a3 = a3 + 2
Next I
Print k, I
Print a1, a2, a3
End Sub
我算了几遍,和运行结果都不一致,每个数值都算的不对。我不明白I的取值到底是怎么样的顺序和流程,请各位大神给指点一下,多谢多谢!
PS:运行结果是 3 13
4 -5 8