打印出倒叙来,至于正序这一点你自己弄(数组赋值),我今天发现了VB为什么一定要用GOTO了,比起C,他的退出叠层循环和数组循环赋值确实有点不行,反正
我是用不惯,用FOR循环给数组赋值时候,老说下表越界。。。。这点确实不如C
Private Sub Command1_Click()
Dim num As Integer
Dim a(4, 2) As Integer
Dim i, j As Integer
a(0, 0) = 2
a(0, 1) = 3
a(0, 2) = 4
a(1, 0) = 8
a(1, 1) = 9
a(2, 0) = 7
a(3, 0) = 5
a(3, 1) = 6
a(4, 0) = 10
a(4, 1) = 11
a(4, 2) = 12
num = CInt(Text1.Text)
Print num
Do Until num = 1 '核心,希望你看懂,不是我害了你
For i = 0 To 4
For j = 0 To 2
If a(i, j) = num Then
num = i + 1
If num = 5 Then num = 9
GoTo break
End If
Next j
Next i
break:
Print num
Loop
End Sub
[[it] 本帖最后由 我是菜鸟哦 于 2008-10-4 20:04 编辑 [/it]]