用随机函数产生50个[10,100 )的随机整数,并按照由小到大的顺序打印出来。 程序界面如下:

2025-04-05 10:26:10
推荐回答(1个)
回答1:

Private Sub Command1_Click()
Dim a(29) As Integer, tmp As Integer
Dim i As Integer, j As Integer
Randomize Time
For i = 0 To 29
a(i) = Int(Rnd * 71) + 30
Next
For i = 0 To 29
For j = i To 29
If a(i) > a(j) Then
tmp = a(i)
a(i) = a(j)