struct CStudent
{
char szID[10];
float eng;
float ch;
float math;
float average(){return (eng+ch+math)/((sizeof(CStudent)-10)/sizeof(float));}
bool operator<(const CStudent& s){return average()<s.average();}
friend istream& operator>>(istream &ins,const CStudent& s)
{
cout<<"学号:";
ins>>szID;
cout<<"依次输入 英语,语文,数学的成绩:";
ins>>eng>>ch>>math;
return ins;
}
friend ostream& operator>>(ostream &ous,const CStudent& s)
{
ous<<"学号:"<<szID<<endl;
ous<<"英语,语文,数学的成绩依次是:";
ous<<eng<<" "<<ch<<" "<<math;
return ous;
}
};
priority_queue<CStudent>stus;
for(int i=0;i<5;i++)
{
CStudent temp;
cin>>temp;
stus.push(temp);
}
for(int i=0;i<3;i++)
{
CStudent temp=stus.top();
cout<<temp;
stus.pop();
}