VB,设计一程序,录入有一批学生的姓名及成绩
附学生姓名及成绩:
李忠秀 85
林 平 89
何明光 56
马 林 93
丁 利 73
宋丽芳 89
饶广梅 98
彭茶阳 85 展开
Dim a(6) As String
Dim b(6) As Integer
Dim c As String
Dim d As Integer
Dim e As Boolean
Dim n As Integer
Private Sub Command1_Click()
If n <= 6 Then
a(n) = InputBox("请输入姓名")
b(n) = InputBox("请输入分数")
n = n + 1
Else
n = 0
c = MsgBox("提示:已到人数上限", vbOKCancel, "提示")
End If
End Sub
Private Sub Command2_Click()
Cls
For i = 0 To 5
e = True
For j = 0 To 5
If b(j) < b(j + 1) Then
c = a(j)
a(j) = a(j + 1)
a(j + 1) = c
d = b(j)
b(j) = b(j + 1)
b(j + 1) = d
e = False
End If
Next j
If e Then
Exit For
End If
Next i
For i = 0 To 5
Print a(i), b(i)
Next i
n = 0
End Sub
望采纳。。。。