如果对一个二维数组进行排序?vb
1个回答
展开全部
Dim a(100) As Integer
Dim temp As Integer
Private Sub Command1_Click()
Print "排序前"
Randomize
For i = 1 To 100
a(i) = Int(Rnd * 901 + 100)
Print a(i);
If i Mod 10 = 0 Then Print
Next i
Print "排序后"
For i = 1 To 100
For j = 1 To 100 - i
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 100
a(i) = Int(Rnd * 901 + 100)
Print a(i);
If i Mod 10 = 0 Then Print
Next i
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询