Dim a(10) As Integer
Sub make()
Randomize
For i = 1 To 10
a(i) = (Rnd * 100)
Print a(i);
Next i
End Sub
Sub prt()
For i = 1 To 10
Print a(i);
Next i
End Sub
Private Sub Command1_Click()
Call make
For i = 1 To 9
k = i
For j = i + 1 To 10
If a(j) > a(k) Then k = j
Next j
t = a(i): a(i) = a(k): a(k) = t
Call prt
Next i
End Sub
Private Sub Command2_Click()
Me.Cls
Call make
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
Call prt
Next i
End Sub
Private Sub Command3_Click()
Me.Cls
End Sub