标签:turn return using cout ota ++ int end pac
#include<iostream>
using namespace std;
int main()
{
struct student{
string studentname;
int qimograde;
int banjigrade;
char xuesgb;
char xibxs;
int lunwen;
int sum;
};
int ts;
cin>>ts;
int n=ts;
student stu[ts];
for(int i=0;i<ts;i++){
cin>>stu[i].studentname;
cin>>stu[i].qimograde;
cin>>stu[i].banjigrade;
cin>>stu[i].xuesgb;
cin>>stu[i].xibxs;
cin>>stu[i].lunwen;
}
for(int i=0;i<n;i++){
stu[i].sum = 0;
if(stu[i].qimograde>80&&stu[i].lunwen>=1) stu[i].sum+=8000;
if(stu[i].qimograde>85&&stu[i].banjigrade>80) stu[i].sum+=4000;
if(stu[i].qimograde>90) stu[i].sum+=2000;
if(stu[i].qimograde>85&&stu[i].xibxs==‘Y‘) stu[i].sum+=1000;
if(stu[i].banjigrade>80&&stu[i].xuesgb==‘Y‘) stu[i].sum+=850;
}
int count=0;
int total=0;
int max=stu[0].sum;
for(int i=0;i<n;i++){
total += stu[i].sum;
if(stu[i].sum>max) {
max=stu[i].sum;
count=i;
}
}
cout<<stu[count].studentname<<endl;
cout<<stu[count].sum<<endl;
cout<<total<<endl;
return 0;
}
标签:turn return using cout ota ++ int end pac
原文地址:http://www.cnblogs.com/sysu-eeman-yang/p/5987452.html