分别使用if语句和select语句编写一个成绩等级判定程序,[90,100]为优秀,[80,90)为良好,[70,80)为中,[

分别使用if语句和select语句编写一个成绩等级判定程序,[90,100]为优秀,[80,90)为良好,[70,80)为中,[60,70)为及格,[0,60)为不及格。

第1个回答  推荐于2018-05-07
Private Sub Pro1()
Dim Score As Single
Score = InputBox(prompt, "输入成绩", 0)
Select Case Val(Score)
Case Is >= 90
MsgBox "优秀"
Case Is >= 80
MsgBox "良好"
Case Is >= 70
MsgBox "中等"
Case Is >= 60
MsgBox "及格"
Case Else
MsgBox "不及格"
End Select
End Sub

Private Sub Pro2()
Dim Score As Single
Score = InputBox(prompt, "输入成绩", 0)
If Val(Score) >= 90 Then
MsgBox "优秀"
Exit Sub
End If
If Val(Score) >= 80 Then
MsgBox "良好"
Exit Sub
End If
If Val(Score) >= 70 Then
MsgBox "中等"
Exit Sub
End If
If Val(Score) >= 60 Then
MsgBox "及格"
Exit Sub
End If
MsgBox "不及格"
End Sub本回答被提问者和网友采纳
相似回答