1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
|
#include <iostream>
#include <string>
#include "CTeam.h"
using namespace std;
CTeam::CTeam(string name = "NoName") {
m_teamName = name;
m_goalsScoredTotal = 0;
m_goalsReceivedTotal = 0;
m_winsTotal = 0;
m_equalTotal = 0;
m_lostTotal = 0;
}
string CTeam::getName() {
return m_teamName;
}
void CTeam::addResult(unsigned int goalsScored, unsigned int goalsReceived){
if (goalsScored > goalsReceived) {
m_winsTotal++;
}
if (goalsReceived > goalsScored) {
m_lostTotal++;
}
if (goalsReceived == goalsScored) {
m_equalTotal++;
}
m_goalsScoredTotal += goalsScored;
m_goalsReceivedTotal+= goalsReceived;
};
unsigned const CTeam:: getTotalPoints(){
return m_winsTotal*3 + m_equalTotal*1;
};
ostream& operator << (ostream &out, const CTeam &rop) {
out<<"CTeam@" << rop.m_winsTotal<< "Spiele gewonnen " << " , " << rop.m_equalTotal << " Spiele unentschieden"<< endl;
out << "CTeam@"<< rop.m_goalsScoredTotal << " Tore erzielt " <<" , " << rop.m_goalsReceivedTotal << " " << " Tore kassiert "<< endl;
};
|