vb 数组中的值怎么排序

如题所述

有多种排序法,下面是其中一种:

Dim i As Integer, j As Integer, a(), k
a = Array(4, 7, 2, 5, 9, 1, 3, 8, 0, 6)
For i = 0 To UBound(a) - 1
    For j = i + 1 To UBound(a)
        If a(i) > a(j) Then
            k = a(i)
            a(i) = a(j)
            a(j) = k
        End If
    Next j
Next i
MsgBox Join(a, ", ")

温馨提示:答案为网友推荐,仅供参考
相似回答