#include "Footballer.h" #include using namespace std; // ------------------------------------------------------------------------------------------------------------- // Functions for Question 2. // ------------------------------------------------------------------------------------------------------------- void InputFootballer(Footballer *pFootballer) { cout << "Enter footballer's name: "; getline(cin, pFootballer->name); cout << "Squad number: "; cin >> pFootballer->squadNumber; cout << "Position code (0=GOALKEEPER, 1=DEFENDER, 2=MIDFIELDER, 3=STRIKER): "; int positionCode; cin >> positionCode; pFootballer->positionCode = (Position)positionCode; cout << "Goals scored: "; cin >> pFootballer->goalsScored; cin.ignore(); } void DisplayFootballer(const Footballer *pFootballer) { cout << pFootballer->name << " (squad number " << pFootballer->squadNumber << ")" << ", position code: " << pFootballer->positionCode << ", goals scored: " << pFootballer->goalsScored << (IsGood ? " is good." : " isn't good.") << endl; } bool IsGood(const Footballer *pFootballer) { return pFootballer->goalsScored >= 10; } // ------------------------------------------------------------------------------------------------------------- // Functions for Question 3. // ------------------------------------------------------------------------------------------------------------- void InputTeam(Footballer team[], int numPlayers) { cout << endl << "Enter details for " << numPlayers << " players: " << endl; for (int i = 0; i < numPlayers; i++) { InputFootballer(&team[i]); } } void DisplayTeam(const Footballer team[], int numPlayers) { cout << endl << "Here are the details for " << numPlayers << " players: " << endl; for (int i = 0; i < numPlayers; i++) { DisplayFootballer(&team[i]); } }