#include "Team.h" #include using std::istream; using std::getline; Team::Team() { } Team::~Team() { } void Team::setTeamName(const string& name) { teamName=name; } const string& Team::getTeamName() const { return teamName; } void Team::setmatchesPlayed(int matchesp) { matchesPlayed=matchesp; } const int Team::getmatchesPlayed() const { return matchesPlayed; } void Team::setgamesWon(int gw) { gamesWon=gw; } const int Team::getgamesWon() const { return gamesWon; } void Team::setgamesLost(int gl) { gamesLost=gl; } const int Team::getgamesLost() const { return gamesLost; } void Team::setpointsWon(int pw) { pointsWon=pw; } const int Team::getpointsWon() const { return pointsWon; } void Team::setpointsLost(int pl) { pointsLost=pl; } const int Team::getpointsLost() const { return pointsLost; } const Team& Team::operator=(const Team& toCopy) { setTeamName(toCopy.getTeamName()); setgamesWon(toCopy.getgamesWon()); setgamesLost(toCopy.getgamesLost()); setpointsWon(toCopy.getpointsWon()); setpointsLost(toCopy.getpointsLost()); setmatchesPlayed(toCopy.getmatchesPlayed()); return *this; } bool Team::operator<(const Team& toComp) { if (getpointsWon() < toComp.getpointsWon()) return true; else { if (getpointsWon() == toComp.getpointsWon()) { if (getpointsLost() < toComp.getpointsLost()) return true; if (getpointsLost() == toComp.getpointsLost()) { if ( (getgamesWon()-getgamesLost()) < (toComp.getgamesWon()-toComp.getgamesLost())) return true; } } return false; } } istream& Team::read(istream& input) { string test; getline( input, test, '\0' ); this->setTeamName(test); input.read( reinterpret_cast (&matchesPlayed), 5 * sizeof( int ) ); return input; }