0_0_23191527_26578.cpp:41:17: error: stray '\' in program
if( cin.get()=='(') { cin>>this->wrong_times; cin.get(); } else { this->wrong_times = 0; } } } }int Problem::GetGrade(){ if( this->accept_time==0 ) { return 0; } else { return this->accept_time + this->wrong_times * this->punish; }}void Problem::SetPunish(){ cin>>Problem::punish;}class Student{public: Student(); void Calculate(); int GetGrade(); int GetAccept(); string& GetName(); void print(); static void SetPeople();private: string name; Problem *questions; int accept_problem; int grade; static int people;};Student::Student(){ cin>>this->name; this->questions = new Problem[this->people]; this->Calculate();}inline string& Student::GetName(){ return this->name;}inline int Student::GetAccept(){ return this->accept_problem;}inline int Student::GetGrade(){ return this->grade;}void Student::Calculate(){ int i, grade; this->accept_problem = 0; this->grade = 0; for(i = 0; i < this->people; i++) { grade = this->questions[i].GetGrade(); if( grade ) { this->grade += grade; this->accept_problem += 1; } }}void Student::SetPeople(){ cin>>Student::people;}bool compare(Student &a,Student &b);bool compare(Student &a,Student &b){ if( a.GetAccept() < b.GetAccept() ) { return false; } if( a.GetAccept() > b.GetAccept() ) { return true; } if( a.GetGrade() < b.GetGrade() ) { return true; } if( a.GetGrade() > b.GetGrade() ) { return false; } if( a.GetName().compare( b.GetName() ) < 0 ) { return true; } else { return false; }}void Student::print(){ cout<<setw(10)<<left<<this->GetName()<<" "<<right<<setw(2)<<this->GetAccept()<<" "<<right<<setw(4)\ <<this->GetGrade()<<endl;}int Problem::punish = 0;int Student::people = 0;int main(){ Student *p; vector<Student>students; Student::SetPeople(); Problem::SetPunish(); while( cin.peek()!=EOF ) { p = new Student(); students.push_back(*p); cin.get(); } sort(students.begin(),students.end(),compare); int i = students.size(),j; for(j = 0; j < i; j++) { students[j].print(); } return 0;}
^
|