Dim i As Integer, N() As String, M() As String
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
i = i + 1
ReDim Preserve N(i)
ReDim Preserve M(i)
N(i) = Text1.text
M(i) = Text2.text
List1.AddItem N(i) & " " & M(i)
End If
End Sub
Private Sub Command1_Click()* 冒泡排序
Dim i As Integer, N As String, M As String
For i = List1.ListCount To 1 Step -1
For j = 1 To i
If M(j) < M(j + 1) Then
M = M(j)
N = N(j)
M(j) = M(j + 1)
N(j) = N(j + 1)
M(j + 1) = M
N(j + 1) = N
End If
Next
Next
List2.Clear
For i = 1 To List1.ListCount
List2.AddItem N(i) & " " & M(i)
Next
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
i = i + 1
ReDim Preserve N(i)
ReDim Preserve M(i)
N(i) = Text1.text
M(i) = Text2.text
List1.AddItem N(i) & " " & M(i)
End If
End Sub
Private Sub Command1_Click()* 冒泡排序
Dim i As Integer, N As String, M As String
For i = List1.ListCount To 1 Step -1
For j = 1 To i
If M(j) < M(j + 1) Then
M = M(j)
N = N(j)
M(j) = M(j + 1)
N(j) = N(j + 1)
M(j + 1) = M
N(j + 1) = N
End If
Next
Next
List2.Clear
For i = 1 To List1.ListCount
List2.AddItem N(i) & " " & M(i)
Next
End Sub