Private Sub Command1_Click()
Dim a(10) As Integer
Dim i As Integer
For i = 1 To 10
a(i) = 10 + Int(Rnd() * 10)
Print a(i);
Next i
Print
Dim j As Integer
For j = 1 To 10
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 Sub swap(a As Integer, b As Integer)
Dim t As Integer
t = a
a = b
b = t
End Sub
Dim a(10) As Integer
Dim i As Integer
For i = 1 To 10
a(i) = 10 + Int(Rnd() * 10)
Print a(i);
Next i
Dim j As Integer
For j = 1 To 10
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 Sub swap(a As Integer, b As Integer)
Dim t As Integer
t = a
a = b
b = t
End Sub