我想用冒泡法把9个数从小到大排序,求好心人帮我看下下面这段小程序显示结果为何不正确
我想用冒泡法把9个数从小到大排序,求好心人帮我看下下面这段小程序显示结果为何不正确Private Sub Command1_Click()
Dim a(1 To 9) As Integer
Dim i As Integer, h As Integer
For i = 1 To 9
a(i) = InputBox("任意输入一位整数")
Next i
i = 1
h = 0
While i < 9
If a(i) > a(i + 1) Then
h = a(i + 1)
a(i + 1) = a(i)
a(i) = h
End If
i = i + 1
Wend
i = 1
Do
Print a(i);
i = i + 1
Loop Until i > 9
End Sub