#include <iostream>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using namespace std;
class info
{
private:
string name;
int result;
int classresult;
string isganbu;
string iswest;
int discourse;
int scolarship;
public:
info(){}
info(string myname,int myresult,int myclassresult,string myisganbu,string myiswest,int mydiscourse)
{
name=myname;
result=myresult;
classresult=myclassresult;
isganbu=myisganbu;
iswest=myiswest;
discourse=mydiscourse;
scolarshipcounter();
}
string getname(){return name;}
int getscolarship(){return scolarship;}
void scolarshipcounter()
{int scolarship1,scolarship2,scolarship3,scolarship4,scolarship5;
if(discourse>=1&&result>80){scolarship1=8000;}
if(result>85&&classresult>80){scolarship2=4000;}
if(result>90){scolarship3=2000;}
if(result>85&&iswest=="Y"){scolarship4=1000;}
if(classresult>85&&isganbu=="Y"){scolarship5=850;}
scolarship=scolarship1+scolarship2+scolarship3+scolarship4+scolarship5;
}
};
int main()
{int n,result,classresult,discourse,max,j,sum;
string name,iswest,isganbu;
info* myinfo;
cin>>n;
myinfo=new info[n];
for(int i=0;i<n;i++)
{
cin>>name>>result>>classresult>>isganbu>>iswest>>discourse;
myinfo[i]=new info(name,result,classresult,isganbu,iswest,discourse);
}
for(i=0;i<n;i++)
{
if(myinfo[i]->getscolarship()>max){max=myinfo[i]->getscolarship();j=i;}
sum+=myinfo[i]->getscolarship();
}
cout<<myinfo[j]->getname()<<endl;
cout<<max<<endl;
cout<<sum<<endl;
delete[] myinfo;
system("pause");
return 0;
}
[此贴子已经被作者于2006-5-6 12:25:17编辑过]