Dim a() As Integer
Private Sub Command1_Click()
ReDim a(1 To Text1.Text)
Dim i As Integer
For i = 1 To Text1.Text
a(i) = (Rnd * 130) + 100
Next i
Dim j As Integer, k As Integer
For i = 1 To Text1.Text
For j = 1 To (Text1.Text - i)
If a(i) < a(i + 1) Then
k = a(i)
a(i) = a(i + 1)
a(i + 1) = k
End If
Next j
Next i
For i = 1 To Text1.Text
Label2.Caption = Label2.Caption & a(i) & " "
Next i
End Sub
半个小时内写的代码。我现在要去吃饭了。余下的你自己想想吧,反正是不难的。