vb运用控件数组,编写一个数据降序排列的小程序
2个回答
展开全部
Module Module1
Sub Main()
Dim a(500) As Integer
Dim temp As Integer
For i = 1 To 500 Step 1
a(i) = Int(Rnd() * 1000 + 10)
Next
For i = 1 To 500 Step 1
For j = 1 To 500 - i Step 1
If a(j) < a(j + 1) Then
temp = a(j + 1)
a(j + 1) = a(j)
a(j) = temp
End If
Next j
Next i
For i = 1 To 500 Step 1
Console.Write(a(i) & vbCrLf)
Next
End Sub
End Module
这个是随机生成500个随机数字,并将数据降序排列的例子,不会再追问。满足的话请采纳吧,谢谢
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询