- 谁拿了最多奖学金
- 2019-10-11 10:52:51 @
#include<iostream>
#include<cstring>
using namespace std;
class STUDENT{
private:
char name;
int score1;
int score2;
char ifleader;
char ifwest;
int scholar;
public:
STUDENT(char a[],int a1,int a2,char YN,char yn,int number){
name=a;
score1=a1;
score2=a2;
ifleader=YN;
ifwest=yn;
scholar=number;
}
int panduan(){
int award=0;
if(score2>80&&ifleader=='Y'){
award+=850;
}
if(score1>85&&score2>80){
award+=4000;
}
if(score1>85&&ifwest=='Y'){
award+=1000;
}
if(score1>80&&scholar>=1){
award+=8000;
}
if(score1>90){
award+=2000;
}
return award;
}
char showname(){
return name;
}
}
;
int main(){
int account;
STUDENT *ptr[101];
char namer[20];
char *point;
int max=0;
char a[30];
int b,c,f;
int total=0;
char d,e;
int i;
cin>>account;
for(i=0;i<account;i++){
cin.getline(a,30,' ');
cin>>b>>c>>d>>e>>f;
ptr[i]=new STUDENT(a,b,c,d,e,f);
total+=ptr[i]->panduan();
if(max<ptr[i]->panduan()){
point=strcpy(namer,ptr[i]->showname());
max=ptr[i]->panduan();
}
}
cout<<point<<endl;
cout<<max<<endl;
cout<<total;
delete ptr;
}
3 条评论
-
pdhai LV 0 @ 2020-03-06 11:33:38
只过了样例是不行的,测试数据集中有更多的数据,你的程序肯定有问题。
-
2020-02-29 11:58:17@
听取WA声一片T^T
http:// -
2019-10-12 22:06:31@
样例过了0分不是很正常么?
- 1