Question: C++ Starter Code: main.cpp /* Update this file to demonstrate thorough testing of the LeaderBoard methods. */ #include int main() { std::cout Athlete.cpp //do not

C++ Starter Code:
main.cpp /* Update this file to demonstrate thorough testing of the LeaderBoard methods. */ #include
int main() { std::cout
Athlete.cpp //do not update #include
Athlete::Athlete() : name_("unknown"), country_("unknown"), points_(0) {
}
Athlete::Athlete(const string& name, const string& country, unsigned points) : name_(name), country_(country), points_(points) { }
string Athlete::getName() const { return this->name_; }
string Athlete::getCountry() const { return this->country_; }
unsigned Athlete::getPoints() const { return this->points_; }
istream& operator>>(istream& input, Athlete& a) { getline(input, a.name_, ','); getline(input, a.country_, ','); input >> a.points_; input.ignore(); return input; }
ostream& operator
Athlete.h //do not update #ifndef ATHLETE_H #define ATHLETE_H #include
class Athlete { private: string name_; string country_; unsigned points_; public: Athlete(); Athlete(const string&, const string&, unsigned);
//Accessors string getName() const; string getCountry() const; unsigned getPoints() const;
friend istream& operator>>(istream&, Athlete&); friend ostream& operator
};
#endif
athletes.csv Matthew Fraser,USA,984 Noah Ohlsen,USA,949 Bjorgvin Karl Gudmudsson,Iceland,888 Scott Panchik,USA,795 James Newbury,Australia,728 Jacob Heppner,USA,694 Matt Mcleod,Australia,671 Adrian Mundwiler,Switzland,632
Leaderboard.cpp #include
LeaderBoard::LeaderBoard() { ifstream file("athletes.csv"); Athlete who; while (!file.eof()) { file >> who; this->board_.push_back(who); } file.close(); } //end of constructor
ostream& operator::reverse_iterator itr; unsigned athlete_rank = b.board_.size(); for (itr = b.board_.rbegin(); itr != b.board_.rend(); itr++) { output
unsigned LeaderBoard::rank_of_athlete(const string& name) { vector
void LeaderBoard::add(const Athlete& a) { vector
void LeaderBoard::remove(const string& name) { vector
Leaderboard.h #ifndef LEADERBOARD_H #define LEADERBOARD_H #include
class LeaderBoard { private: vector
//accessors //Can't add const at the end because we're not teaching constant iterators. unsigned rank_of_athlete(const string& name);
//mutators void add(const Athlete& a); void remove(const string& name);
friend ostream& operator
#endif
class LeaderBoard { private: vector
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
