再一次写VB作业,学以致用的feel真的不一样,啊哈哈哈哈哈。。。。。。
Private Sub Command1_Click()
Cls
Font.Size = 30
Dim n As Integer
Dim sierdun(15) As Integer
n = 1
While n <= 15
sierdun(n) = Int(Rnd * 1000)
n = n + 1
Wend
Dim swap As Integer
n = 1
While n <= 14
If sierdun(n) < sierdun(n + 1) Then
swap = sierdun(n)
sierdun(n) = sierdun(n + 1)
sierdun(n + 1) = swap
End If
n = n + 1
Wend
n = 1
While n <= 15
Print sierdun(n)
n = n + 1
Wend
End Sub
Private Sub Command1_Click()
Cls
Font.Size = 30
Dim n As Integer
Dim sierdun(15) As Integer
n = 1
While n <= 15
sierdun(n) = Int(Rnd * 1000)
n = n + 1
Wend
n = 1
While n <= 15
Print sierdun(n)
n = n + 1
Wend
End Sub
Option Base 1
Private Sub Command1_Click()
Cls
Font.size = 30
Dim n As Integer
Dim sierdun(10) As Integer
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
If sierdun(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
n = 1
While n <= 10
Print sierdun(n)
n = n + 1
Wend
End Sub