- 谁拿了最多奖学金
- 2017-04-13 14:07:28 @
#include<stdio.h>
struct xuesheng{
char name[20];
int qimo;
int banji;
char ganbu[2];
char xibuxuesheng[2];
int shumu;
};
int main()
{
int i;
int sum=0;
int t;
int bonus[4]={0};
int max;
struct xuesheng stu[4]={{"Yaolin",87,82,"Y","N",0},
{"ChenRuiyi",88,78,"N","Y",1},
{"LiXin",92,88,"N","N",0},
{"ZhangQin",83,87,"Y","N",1}};
for(i=0;i<4;i++) {
if(stu[i].qimo>80&&stu[i].shumu!=0) bonus[i]=8000;
if(stu[i].qimo>85&&stu[i].banji>80) bonus[i]=bonus[i]+4000;
if(stu[i].qimo>90) bonus[i]=bonus[i]+2000;
if(stu[i].qimo>85&&*stu[i].xibuxuesheng=='Y') bonus[i]=bonus[i]+1000;
if(stu[i].banji>80&&*stu[i].ganbu=='Y') bonus[i]=bonus[i]+850;
}
for(i=0;i<4;i++) sum=sum+bonus[i];
max=bonus[0];
for(i=0;i<4;i++){
if(max<=bonus[i]) { max=bonus[i]; t=i;}
}
printf("%s\t%d\n",stu[t].name,max);
printf("%d\n",sum);
return 0;
}
1 条评论
-
2714040588 LV 4 @ 2017-11-08 13:58:21
额,大哥先看清题
- 1