第1个回答 2019-05-08
Option Explicit
Private Sub Command1_Click()
Dim a(4) As Double, i As Integer
For i = 0 To 4
a(i) = Val(InputBox("input a number", , 5))
Print a(i);
Next
Print
Call px(a)
For i = 0 To 4
Print a(i);
Next
End Sub
Private Sub px(a() As Double)
Dim i As Integer, j As Integer, tmp As Integer
For i = 0 To UBound(a)
For j = i + 1 To UBound(a)
If a(j) < a(i) Then
tmp = a(j)
a(j) = a(i)
a(i) = tmp
End If
Next
Next
End Sub本回答被网友采纳