#include <iostream>
#include <iomanip>
#include <string>
#include "PR.h"
usingnamespace std;
int main()
{
int n; //number of footballers
int i; //loop for user selection
int goals; //number of goals scored by player
int choice; //choices between divisionOne and divisionTwo
string name; //name of football player
string club; //club for football player
PR *footballStar[50]; // limit only to 50 player and stores into the division chosen either division<1> or division<2>
cout << "Insert number of footballer<s>:\t";
cin >> n;
cout << endl;
for (i = 0; i < n; i++) //number of footballer user entered
{
cin.get();
cout << "Name of footballer " << i + 1 << ":"; //i+1 is when the number of the footballer is added
getline(cin, name);
cout << endl;
cout << "Name of club " << i+1 << ":";
getline(cin, club);
cout << endl;
cout << "Division One<1> or Division Two<2>?: ";
cin >> choice;
//while loop execution
while (i = 1) //choices are one
{
if (choice == 1) //if user select division <1>
{
footballStar[i] = new PR(name, club, goals, choice); //[i] refers to loop for the user selection: Division<1> where footballStar points to the PR *footballStar[50]
break;
}
elseif (choice == 2) //if user select division <2>
{
footballStar[i] = new PR(name, club, goals, choice); //[i] refers to loop for the user selection: Division<2> where footballStar points to the PR *footballStar[50]
break;
}
else
{
cout << "Footballer division entered in does not exist in the system.";
cout << "\nPlease key in again.";
cout << endl << endl;
i--; //error message and value of counter i will be decreased
break;
}
}
cout << "Number of goals scored in this season: " << goals << endl;
}
for (i = 0; i < n; i++)
{
footballStar[i]->getbonussalary();
}
return(0);
}