产生20个[0,99]之间的随机整数,并按从小到大的顺序输出 (用VB程序解答)

下午就要清考,关乎生死,求高手诚心回答啊!
2024-12-12 01:58:51
推荐回答(1个)
回答1:

Private Sub Command1_Click()
Dim i%, mArr(19), m%, t%
For i = 0 To 19
Randomize
mArr(i) = Int(Rnd * 100)
Next i
For i = 0 To 18
For m = i + 1 To 19
If mArr(m) < mArr(i) Then t = mArr(i): mArr(i) = mArr(m): mArr(m) = t
Next m
Next i
Print Join(mArr, ", ")
End Sub