1个回答
展开全部
Private Sub Command1_Click()
Dim a(50) As String, b(50) As Integer
n = CInt(InputBox("班级人数="))
For i = 1 To n
a(i) = InputBox("No." & i & "姓名:")
b(i) = InputBox("No." & i & "成绩:")
Next i
For i = 1 To n - 1
For j = 1 To n - 1 - i
If b(j) < b(j + 1) Then
a(0) = a(j): a(j) = a(j + 1): a(j + 1) = a(0)
b(0) = b(j): b(j) = b(j + 1): b(j + 1) = b(0)
End If
Next j
Next i
For i = 1 To n
Print a(i), b(i)
Next i
End Sub
Dim a(50) As String, b(50) As Integer
n = CInt(InputBox("班级人数="))
For i = 1 To n
a(i) = InputBox("No." & i & "姓名:")
b(i) = InputBox("No." & i & "成绩:")
Next i
For i = 1 To n - 1
For j = 1 To n - 1 - i
If b(j) < b(j + 1) Then
a(0) = a(j): a(j) = a(j + 1): a(j + 1) = a(0)
b(0) = b(j): b(j) = b(j + 1): b(j + 1) = b(0)
End If
Next j
Next i
For i = 1 To n
Print a(i), b(i)
Next i
End Sub
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询