Private Sub Command1_Click()
Me.FontSize = 20
Dim a(10) As Integer
Dim i As Integer
For i = 1 To 10
a(i) = 10 + Int(Rnd() * 100)
Print a(i);
Next i
Print
Dim j As Integer
For j = 1 To 9
For i = j + 1 To 10
If a(j) < a(i) Then
swap a(j), a(i)
End If
Next i
Next j
For i = 1 To 10
Print a(i);
Next i
Print
End Sub
Private Function swap(a As Integer, b As Integer)
Dim t As Integer
t = a
a = b
b = t
End Function
Me.FontSize = 20
Dim a(10) As Integer
Dim i As Integer
For i = 1 To 10
a(i) = 10 + Int(Rnd() * 100)
Print a(i);
Next i
Dim j As Integer
For j = 1 To 9
For i = j + 1 To 10
If a(j) < a(i) Then
swap a(j), a(i)
End If
Next i
Next j
For i = 1 To 10
Print a(i);
Next i
End Sub
Private Function swap(a As Integer, b As Integer)
Dim t As Integer
t = a
a = b
b = t
End Function