VBS 数组冒泡排序

 

 

'定义变量
Dim arr1
'数组赋值
arr1 = array(3, 6, 8, 7, 1, 2, 9,10)
For m = 0 To UBound(arr1)
    For i = m+1 To UBound(arr1)
        k=arr1(m)
        If arr1(m) < arr1(i) Then 
            arr1(m) = arr1(i)
            arr1(i) = k
        End If
    Next
    msgbox arr1(m)
Next

 

posted @ 2017-08-26 16:14  LLSix  阅读(342)  评论(0编辑  收藏  举报