随意生成10个数并排序(冒泡排序法)

Private Sub Command1_Click()
Me.Font.Size = 30
Dim a(10) As Integer
Dim i As Integer
Dim t As Integer
Dim p As String
For i = 1 To 10
   a(i) = 10 + Int(Rnd() * 100)
   Print a(i);
Next i
Print
Dim j As Integer
For i = 1 To 9
For j = 1 To 10 - i
   If a(j) < a(j + 1) Then
      t = a(j): a(j) = a(j + 1): a(j + 1) = t
   End If
 Next j
 Next i
 For i = 1 To 10
  p = p & Str(a(i))
Next i
Print p
End Sub

随意生成10个数并排序(冒泡排序法)_第1张图片

你可能感兴趣的:(随意生成10个数并排序(冒泡排序法))