日期:2011-08-05 浏览次数:20464 次
语法:VB .net
环境:.NetFrameword1.1
Dim i, j, k As Integer
Dim tmp As Integer
Dim sr(20) As String
Dim rr(20) As String
sr(1) = 2
sr(2) = 11
sr(3) = 1
sr(4) = 4
sr(5) = 3
sr(6) = 12
sr(7) = 5
sr(8) = 13
sr(9) = 7
sr(10) = 14
sr(11) = 6
sr(12) = 18
sr(13) = 8
sr(14) = 17
sr(15) = 9
sr(16) = 10
sr(17) = 15
sr(18) = 19
sr(19) = 16
For i = 1 To 19
For j = 1 To 20 - i
If Convert.ToInt16(sr(j)) < Convert.ToInt16(sr(j + 1)) Then
tmp = sr(j)
sr(j) = sr(j + 1)
sr(j + 1) = tmp
End If
Next
Next
For i = 1 To 19
T1.Text = T1.Text + sr(i) + vbCrLf
Next