VB关于排序的菜鸟问题
发布网友
发布时间:2024-10-12 11:25
我来回答
共1个回答
热心网友
时间:2024-10-14 02:40
这次没问题了:
Private Sub Form_Click()
Dim a()
a = Array(7, 4, 9, 8, 6, 1)
n = 5 'n为数组元素的下标
For i = 0 To n - 1
s = i
For j = n To i + 1 Step -1
If a(s) < a(j) Then s = j
Next j
t = a(i): a(i) = a(s): a(s) = t
Next i
For i = 0 To n
Print a(i)
Next
end sub