随机个数排序

老师讲完了,拍到手机上了,照着抄还是错误不断

大哥,你丫是干啥吃的啊,我也是醉了!!!

Option Base 1
Private Sub Command1_Click()
    Cls
    Dim x As Integer
    x = Int(Val(Me.Text1.Text))
    Dim n As Integer
    Dim A() As Integer
    ReDim A(x)
   
    n = LBound(A)
    While n <= UBound(A)
    A(n) = Int(Rnd * 1000)
    n = n + 1
    Wend
    Dim B As Integer, M As Integer
    M = LBound(A)
    While M <= UBound(A) - 1
    n = LBound(A)
    While n <= UBound(A) - M
    If A(n) < A(n + 1) Then
    B = A(n): A(n) = A(n + 1): A(n + 1) = B
    End If
    n = n + 1
    Wend
    M = M + 1
    Wend
n = LBound(A)
While n <= UBound(A)
Print A(n)
n = n + 1

Wend
End Sub

你可能感兴趣的:(随机个数排序)