合并有序的数组a,b为数组c,将数组c排序后输出Private Sub Command1_Click()Dim cc = Split(Label1.Caption & "," & Label2.Caption & ",")For i = 0 To UBound(c) - 1For j = i To UBound(c)If c(i) > c(j) Thent = c(i)c(i) = c(j)c(j) = tEnd IfNext jNext iLabel3.Caption = Join(c,",")End SubPrivate Sub Form_Load()Dim a,ba = Array(11,25,56,67,77,98)b = Array(8,33,56,93)Label1.Caption = Join(a,",")Label2.Caption = Join(b,",")End Sub为什么输出的c不是排好顺序的,是11,25,56,67,77,98,8,33,56,93
合并有序的数组a,b为数组c,将数组c排序后输出
Private Sub Command1_Click()
Dim c
c = Split(Label1.Caption & "," & Label2.Caption & ",")
For i = 0 To UBound(c) - 1
For j = i To UBound(c)
If c(i) > c(j) Then
t = c(i)
c(i) = c(j)
c(j) = t
End If
Next j
Next i
Label3.Caption = Join(c,",")
End Sub
Private Sub Form_Load()
Dim a,b
a = Array(11,25,56,67,77,98)
b = Array(8,33,56,93)
Label1.Caption = Join(a,",")
Label2.Caption = Join(b,",")
End Sub
为什么输出的c不是排好顺序的,是11,25,56,67,77,98,8,33,56,93