Oh,my god......每次vb作业都会剩一个,剩的这一个就总是那么费脑细胞,真是没谁了,有时候做作业做不下去时,想到..那句话,天将降大任于斯人也,顿时有了做作业的勇气.
come on,胜利总是在挫折的后面,哈哈哈哈,反正还是做完了,小小的开心一下.........
Option Base 1
Private Sub Command1_Click()
Dim n As Integer
Dim size As Integer
size = Int(Val(Me.Text1.Text))
Dim sierdun() As Integer
ReDim sierdun(size)
n = LBound(sierdun)
While n <= UBound(sierdun)
sierdun(n) = Int(Rnd * 1000)
n =n + 1
Wend
Dim swap As Integer
m = LBound(sierdun)
While m <= UBound(sierdun) - 1
n = LBound(sierdun)
While n <= UBound(sierdun) - m
Ifsierdun(n) < sierdun(n + 1) Then
swap = sierdun(n)
sierdun(n) = sierdun(n + 1)
sierdun(n + 1) = swap
End If
n= n + 1
Wend
m= m + 1
Wend
While n <= UBound(sierdun)
Print sierdun(n)
n =n + 1
Wend