Private Sub Command1_Click()'方法1
Dim i&, j&, s&(50)
Randomize
For i = 1 To 50
s(i) = Int(Rnd * 91 + 10)
Next
For i = 1 To 50
For j = i + 1 To 50
If s(j) < s(i) Then
s(0) = s(j)
s(j) = s(i)
s(i) = s(0)
End If
Next
Print s(i);
If i Mod 10 = 0 Then Print
Next
End Sub
Private Sub Command2_Click()'方法2
Dim i&, j&, n&, t&(10 To 100)
Randomize
For i = 1 To 50
j = Int(Rnd * 91 + 10)
t(j) = t(j) + 1
Next
For i = 10 To 100
For j = 1 To t(i)
Print i;
n = n + 1
If n = 10 Then Print: n = 0
Next
Next
End Sub