Dim n As Integer
Dim a() As Double
Private Sub Command1_Click()
n = InputBox("请输入要输入的数据个数")
ReDim a(1 To n)
For i = 1 To n
a(i) = InputBox("请输入第" & i & "个数据")
Next i
Do
Call mp(a)
Loop Until UBound(a) <= 2
End Sub
Public Sub mp(ByRef a() As Double)
Dim temp As Double
Dim m As Integer
m = UBound(a)
For i = 1 To m
For j = 1 To m - i
If a(j) < a(j + 1) Then
temp = a(j + 1)
a(j + 1) = a(j)
a(j) = temp
End If
Next j
Next i
a(m - 1) = a(m - 1) + a(m)
ReDim Preserve a(1 To m - 1)
For i = 1 To m - 1
Print a(i) & " ";
Next i
Print
End Sub
望采纳!