數字排序


[參考程式碼]

Dim a(11) As Integer

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim i As Integer, msg As String="原始數列:"

For i = 1 To 10

  a(i) = Int(Rnd() * 100)

  msg &= a(i) & space(3)

Next

 Label1.Text = msg

End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  
  Dim msg As String = "升冪排序: "

  
    '用Array的方法完成升冪排序(1)


   For Each s In a
    msg &= s & space(3)
   Next

     Label2.text=Msg

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
  

    Dim msg As String = "降冪排序: "

  
    '用Array的方法完成降冪排序(2)


   For Each s In a
    msg &= s & space(3)
   Next

     Label2.text=Msg


 End Sub