Private Sub Command1_Click()
Dim A(1 To 10) As Single, S As Single, N(1 To 10) As String
For i = 1 To 10
Do
N(i) = InputBox("请输入第" & i & "位同学的姓名:")
Loop While Len(N(i)) = 0
Do
A(i) = Val(InputBox("请输入" & N(i) & "同学的成绩,必须>=0且<=100"))
Loop While A(i) < 0 Or A(i) > 100
S = S + A(i)
Next
Cls
Print "全班平均分为:" & S / 10
For i = 1 To 10
For j = i + 1 To 10
If A(i) < A(j) Then
t = A(i)
A(i) = A(j)
A(j) = t
N(i) = N(i) & N(j)
N(j) = Left(N(i), Len(N(i)) - Len(N(j)))
N(i) = Right(N(i), Len(N(i)) - Len(N(j)))
End If
Next
Next
For i = 1 To 10
Print N(i), A(i),
If A(i) > S * 1.1 / 10 Then
Print "得一等奖学金"
ElseIf A(i) > S * 1.05 / 10 Then
Print "得二等奖学金"
Else
Print "没有奖学金"
End If
Next
End Sub