2024-11-08 00:00:47
Private Sub Command1_Click()
Dim a(1 To 10) As Integer
Dim i As Integer, j As Integer
Print "随机取到的10个50-100(包括50和100)的随机整数为"
For i = 1 To 10
Randomize
a(i) = Int(Rnd() * 51 + 50)
Print a(i);
Next i
Print "用“冒泡排序”按从小到大的顺序排序后"
For i = 1 To 10
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
Next i
For i = 1 To 10
Print a(i);
Next i
End Sub
2024-11-08 00:12:24
2024-11-08 00:23:03