选择法排序的代码编码?
发布网友
发布时间:2022-05-02 18:38
我来回答
共1个回答
热心网友
时间:2022-06-21 06:33
Private Sub Command1_Click()
Dim x(1 To 5) As Integer
Dim n, i, j As Integer
n = 5
For i = 1 To n
x(i) = Val(InputBox("请输入"))
Next
For i = 1 To n - 1
For j = i + 1 To n
If x(i) > x(j) Then
temp = x(i): x(i) = x(j): x(j) = temp
End If
Next j
Next i
For i = 1 To 5
Print x(i);
Next
End Sub