诸位,帮我做一道入门编程题!!!(100分)

  • 主题发起人 fangws_hzb
  • 开始时间
F

fangws_hzb

Unregistered / Unconfirmed
GUEST, unregistred user!
编程:计算某个学生奖学金的等级,以三门功课成绩M1,M2,M3为评奖依据。奖学金评奖标准如下:
一等奖。符合下列条件之一的可得一等奖:
1、 平均分大于95分者
2、 有两门成绩是100分,且第三门功课成绩不低于80分者。
二等奖。符合下列条件之一的可得二等奖:
1、 平均分大于90分者。
2、 有一门成绩是100分,且其他功课成绩不低于75分者。
三等奖。各门功课成绩不低于70分者。
符合条件者就高不就低,只能获得高的那一项奖学金。要求显示获奖的等级。

 
create table test(M1,M2,M3,等级)
update test set 等级=3 where M1>=70 and M2>=70 and M3>=70
update test set 等级=2 where (M1+M2+M3>=90*3) or (M1>=75 and M2>=75 and M3>=75 and (M1=100 or M2=100 or M3=100))
update test set 等级=1 where (M1+M2+M3>=95*3) or (M1=100 and M2=100 and M3>=80) or (M1=100 and M3=100 and M2>=80) or(M3=100 and M2=100 and M1>=80)
 
if (m1+m2+m3)/3 > 95 then

begin
V_bool:=true;
j:=0;
if m1=100 then
j:=j+1 else
if m1<80 then
V_Bool:=false;
if m2=100 then
j:=j+1 else
if m2<80 then
V_Bool:=false;
if m3=100 then
j:=j+1 else
if m3<80 then
V_Bool:=false;

if j<2 then
V_Bool:=false;
if V_Bool then
V一等奖:=true;
end
else
if (m1+m2+m3)/3 > 90 then

begin
V_bool:=true;
j:=0;
if m1=100 then
j:=j+1 else
if m1<75 then
V_Bool:=false;
if m2=100 then
j:=j+1 else
if m2<75 then
V_Bool:=false;
if m3=100 then
j:=j+1 else
if m3<75 then
V_Bool:=false;

if j<1 then
V_Bool:=false;
if V_Bool then
V二等奖:=true;
end
else
begin
V_bool:=true;
if m1<70 then
V_Bool:=false;
if m2<70 then
V_Bool:=false;
if m3<70 then
V_Bool:=false;

if V_Bool then
V三等奖:=true;
end;
 
哥们,有没有简洁点好办法呀
 
if (((m1+m2+m3)/3)>95) and (((m1=100 or m2=100)or(m1=100 or m3=100)or(m2=100 or m3=100)))and((m1+m2+m3)>280)
then

begin
showmessage('一等奖');
exit;
end;

if (((m1+m2+m3)/3)>90) and (((m1=100)or(m2=100)or(m3=100)))and((m1 > 75)and(m2>75)and(m3 > 75))
then
begin
showmessage('二等奖');
exit;
end;

if (m1>= 70) and (m2 >= 70) and (m3 >= 70)
then
begin
showmessage('三等奖');
exit;
end
else
showmessage('鼓励等奖');
 
老兄,你想简单是吧,那就不用做了,代码是肯定要写的。否则你那么多判断条件谁给你判断
啊?不过我建议你用一个dbgrid,加入一计算字段,计算出每条记录(也就是学生成绩)的
获奖情况,写这点判断代码不用十分钟!
 
建哈夫曼树
 
boye写的代码里(m1+m2+m3)>280可以不要的吧??代码是肯定要写的了,别偷懒:)
 
顶部