问道VB的题

来源:百度知道 编辑:UC知道 时间:2024/05/26 14:01:56
问道VB的题
已知测试计分情况为:数学(math)满分50分;计算机(computer)满粉100分;外语6级(lang6)为"优秀"加15分、“通过”加8分,外语4级(lang4)为“合格”加6分,外语只能计一次最高的分数。利用InputBox输入一个学生的对应课程的成绩,编写计算机考试总分数(sum)的程序段。
括号里是对应变量名

sub Gettotal()
sum=0
math=inputbox("请输入数学分数")
if math>50 then
msgbox "错误, 满分为50"
exit sub
end if
sum=math

computer=inputbox("请输入计算机分数")
if computer>100 then
msgbox "错误, 满分为100"
exit sub
end if
sum=sum+computer

lang6=inputbox("请输入外语6级")
select case lang6
case "优秀"
sum=sum+15
case "通过"
sum=sum+8
end select

lang4=inputbox("请输入外语4级")
if lang4="合格" then
if lang6="通过" or lang6="优秀" then
else
sum=sum+6
end if
end if

msgbox "总分=" & sum

end sub

没听清楚