Sub 数组排序()
ARR = Array(5, 8, 4, 3, 2, 1, 9, 4, 6, -10, 0, 0.2, 100)
Dim A As Long
A = UBound(ARR)
ReDim BRR(A)
Dim i As Long
Dim J As Long
Dim STR As Double
For i = LBound(ARR) To UBound(ARR)
STR = STR + Abs(ARR(i))
Next
For i = LBound(ARR) To UBound(ARR)
BRR(i) = STR
For J = LBound(ARR) To UBound(ARR)
If ARR(J) <> "+" Then
If ARR(J) - BRR(i) <= 0 Then
BRR(i) = ARR(J)
End If
End If
Next
For J = LBound(ARR) To UBound(ARR)
If BRR(i) = ARR(J) Then
ARR(J) = "+"
Exit For
End If
Next
Debug.Print BRR(i)
Next
End Sub
09-08
4845