用10个10~100之间的数,用VB按值从大到小顺序排序,最后输出结果的编码是什么?
给出十个10~100的整数,用“选择排序法”按值从大到小顺序排序,最后输出结果,用VB怎么做?
答案:2 悬赏:30 手机版
解决时间 2021-04-30 00:08
- 提问者网友:最美的风景
- 2021-04-29 02:40
最佳答案
- 五星知识达人网友:洎扰庸人
- 2021-04-29 02:54
Private Sub Command1_Click()
Dim a(10) As Integer
For i = 0 To 9
a(i) = Int(Rnd * 91) + 10
Next i
For i = 0 To 9
m = i
For j = i + 1 To 9
If a(m) > a(j) Then m = j
Next j
t = a(m): a(m) = a(i): a(i) = t
Print a(i);
Next i
Print
End Sub
Dim a(10) As Integer
For i = 0 To 9
a(i) = Int(Rnd * 91) + 10
Next i
For i = 0 To 9
m = i
For j = i + 1 To 9
If a(m) > a(j) Then m = j
Next j
t = a(m): a(m) = a(i): a(i) = t
Print a(i);
Next i
End Sub
全部回答
- 1楼网友:撞了怀
- 2021-04-29 03:59
Private Sub Command1_Click()
Dim i, j As Integer
Dim a(10) As Integer
Dim b, c As Integer
For i = 0 To 9
a(i) = Int(Rnd * 90 + 10)
Next i
For i = 0 To 9
b = i
For j = i + 1 To 9
If a(b) < a(j) Then b = j
Next j
c = a(b)
a(b) = a(i)
a(i) = c
Print a(i);
Next i
Print
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯