Page 104 -
P. 104

第五章 陣列與排序

         End If

            Next
      Next
      For i = 0 To 9

            op &= B(i) & " "
      Next
      Label2.Text = op
      op = Nothing
End Sub

      Private Sub Button2_Click(sender As System.Object, e ………………………

            Dim B() As Integer = {56, 83, 24, 78, 36, 15, 68, 41, 19, 93}
            Dim temp As Integer, op As String
            For i = 0 To 8

                  For j = i + 1 To 9
                        If B(i) < B(j) Then
                              temp = B(i) : B(i) = B(j) : B(j) = temp
                        End If

                  Next
            Next
            For i = 0 To 9

                  op &= B(i) & " "

            Next
            Label2.Text = op
            op = Nothing
      End Sub
End Class

(三)執行結果

                              100
   99   100   101   102   103   104   105   106   107   108   109