VB 用InputBox函数输入一个分数

来源:百度知道 编辑:UC知道 时间:2024/09/12 15:07:04
编程,用InputBox函数输入一个分数,若大于90,用MsgBox函数提示“优秀”;若分数介于[80,89]区间内,则提示“良好”;[70,79]区间内提示“中”;[60,69]区间内,提示“及格”;若分数小于60,则提示“不及格”。

Dim s As Integer
s = Val(InputBox(""))
Select Case s
Case Is >= 90
MsgBox "优秀"
Case Is >= 80
MsgBox "良好"
Case Is >= 70
MsgBox "中"
Case Is >= 60
MsgBox "及格"
Case Else
MsgBox "不及格"
End Select

Private Sub Form_click()
n = Val(InputBox("输入分数"))
Select Case n
Case 0 To 59
MsgBox "不及格"
Case 60 To 69
MsgBox "及格"
Case 70 To 79
MsgBox "中"
Case 80 To 89
MsgBox "良好"
Case 90 To 100
MsgBox "优秀"
End Select
End Sub

Dim n As Integer
Dim str As String
n = Int(Val(InputBox("请输入一个成绩分数", "输入分数")))
If n >= 90 And n <= 100 Then
str = Format("分数为" & n & "成绩为优秀&qu