- 谁拿了最多奖学金
- 2009-08-19 21:10:10 @
#include
using namespace std;
class Student
{
private:
int termscore;
int classscore;
char cadre;
char fromwest;
int papernum;
int collegeprz();
int ffprz();
int greatprz();
int westprz();
int contriprz();
public:
char name[20];
int total;
Student();
void totalprz();
};
Student::Student()
{
cin>>name>>termscore>>classscore>>cadre>>fromwest>>papernum;
}
int Student::collegeprz()
{
if(termscore>80&&papernum>=1)
return 8000;
else
return 0;
}
int Student::ffprz()
{
if(termscore>85&&classscore>80)
return 4000;
else
return 0;
}
int Student::greatprz()
{
if(termscore>90)
return 2000;
else
return 0;
}
int Student::westprz()
{
if(termscore>85&&'Y'==fromwest)
return 1000;
else
return 0;
}
int Student::contriprz()
{
if(termscore>80&&'Y'==cadre)
return 850;
else
return 0;
}
void Student::totalprz()
{
total=collegeprz()+ffprz()+greatprz()+westprz()+contriprz();
}
int main()
{
int num;
cin>>num;
Student* stu=new Student[num];
for(int i=0;itotalprz();
}
int max=0,count=0;
char* name;
for(int j=0;jtotal>max)
{
max=(stu+j)->total;
name=(stu+j)->name;
}
count+=(stu+j)->total;
}
cout