求学长们指导VB一个问题
小弟的作业1道题不会做,老出错,快要交了很急,请大哥们忙忙帮写下能运行得完整程序,万分感谢阿!
已知软件学院入学测试计分情况为:数学(math)满分50分;计算机(computer)满分100分;外语6级(lang6)为”优秀”加15分、”通过”加8分,外语4级(lang4)为”合格”加6分,外语只能计一次最高的分数。利用inputBox输入一个学生的对应课程的成绩,编写计算考试总分(sum)的程序段。注:括号内为对应课程的变量名。
[解决办法]
数学(math)满分50分;
计算机(computer)满分100分;
外语6级(lang6)为”优秀”加15分、”通过”加8分,
外语4级(lang4)为”合格”加6分。
------------------------------------------------
dim Intlang6 as integer
if lang4= "合格 " then Intlang6=4
select case lang6
case "优秀 ":Intlang6=15
case "通过 ":Intlang6=8
end select
sum=math+computer+Intlang6
[解决办法]
把楼上的再丰富一下,呵呵
Dim sum As Integer
Dim Math As Integer
Dim Intlang6 As Integer
Dim computer As Integer
Dim lang4 As String
Math = InputBox( "请输入学生的数学成绩 ")
If Math < 0 Or Math > 50 Then
MsgBox "数学成绩应该在0-50之间 "
computer = InputBox( "请输入学生的计算机成绩 ")
If computer < 0 Or computer > 100 Then
MsgBox "计算机成绩应该在0-100之间 "
lang4 = InputBox( "请输入学生的英语成绩 ")
If lang4 = "合格 " Then Intlang6 = 4
Select Case lang4
Case "优秀 ": Intlang6 = 15
Case "通过 ": Intlang6 = 8
End Select
sum = Math + computer + Intlang6
MsgBox "该学生的总成绩为: " & sum & " ", vbOKOnly, "成绩合计 "