您的位置:首页 > 其它

排序

2016-04-01 16:04 197 查看
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

m = 1

While m <= 14

n = 1

While n <= 15 - 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 <= 15

Print sierdun(n)

n = n + 1

Wend

End Sub
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: