Private Sub Form_Load()
Show
Dim a(10) As Integer
For i = 1 To 10
a(i) = 1 + Rnd() * 99
Print a(i);
Next
For i = 1 To 10
For j = 1 To 10
If a(j) > a(i) Then
temp = a(i)
a(i) = a(j)
a(j) = temp
End If
Next j
Next i
Print Chr(10) + Chr(13)
For i = 1 To 10
Print a(i);
Next i
End Sub
Private Sub Command1_Click()
Me.Cls
Dim i As Integer, j As Integer, temp As Integer, x As New Collection, y As New Collection
For i = 0 To 99
x.Add i + 1
Next
Randomize
For i = 0 To 9
temp = Int(Rnd * x.Count + 1)
y.Add x(temp)
x.Remove temp
Next
Set x = Nothing
Dim min As Integer
For i = 1 To 10
min = CInt(y(1))
temp = 1
For j = 1 To y.Count
If min > CInt(y(j)) Then min = CInt(y(j)): temp = j
Next
x.Add min
y.Remove temp
Next
For i = 1 To 10
Print x(i)
Next
Set x = Nothing
Set y = Nothing
End Sub