VB高手改写冒泡排序
答案:1 悬赏:50 手机版
解决时间 2021-03-20 05:18
- 提问者网友:無理詩人
- 2021-03-19 21:05
VB高手改写冒泡排序
最佳答案
- 五星知识达人网友:像个废品
- 2021-03-19 21:54
已经改为冒泡排序:
Private Sub command1_click()
Dim a(1 To 10) As Integer
Print
Print "原数列是"
Randomize
For i = 1 To 10
a(i) = Int(Rnd * 90 + 10)
Print a(i); " ";
Next i
For i = 1 To 9
For j = 1 To 10 - i
If a(j) < a(j + 1) Then t = a(j + 1): a(j + 1) = a(j): a(j) = t
Next j
Next i
Print
Print "排列后的数列是:"
For i = 1 To 10
Print a(i); " ";
Next i
End Sub
Private Sub command1_click()
Dim a(1 To 10) As Integer
Print "原数列是"
Randomize
For i = 1 To 10
a(i) = Int(Rnd * 90 + 10)
Print a(i); " ";
Next i
For i = 1 To 9
For j = 1 To 10 - i
If a(j) < a(j + 1) Then t = a(j + 1): a(j + 1) = a(j): a(j) = t
Next j
Next i
Print "排列后的数列是:"
For i = 1 To 10
Print a(i); " ";
Next i
End Sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯