问选择结构程序
从输入框输入一名学生的成绩(100分为满分),在消息框输出成绩等级,90分以上为A等,80-89为B.70......60分以下为E等.
书上如下:
Private Sub Command1_Click()
Dim grade As Single, result As String
grade = val (inputbox("请输入成绩:”,“成绩输入”))
Select Case grade
Case Is >= 90
result = "A"
Case Is >= 80
result = "B"
Case Is >= 70
result = "C"
Case Is >= 60
result = "D"
Case Else
result = "E"
End Select
MsgBox "该生的成绩等级为:”+ result,,"成绩等级"
End Sub
Private Sub command2_click()
End
End Sub
主窗口有"运行"和"结束"按纽,单击"运行",显示出"成绩输入"输入框,输入成绩后单击"确定"按纽,显示出"成绩等级"消息框.按"运行"继续输入,按"结束"即可结束运行.
问:怎样编出消息框,输入框窗口?为什么编译出错?给个完整代码并大概在后边注释如何?