This program should take the data from 11 soccer players and it should retrieve it from a file. i have to use a struct in it and I have to make the players into an array. I have figured out everything but my program is giving me an error in the main part and I am still unsure of why. If you could offer any advice that would be helpful
Also her is some of the code but I have no idea how to use tags and this is my first time so hopefully your not too upset with my code and hopefully it is readable.
Code:
struct soccerPlayer
{
string name;
int number, points;
};
void enterData(soccerPlayer player[], int, int);
int main()
{
int SIZE = 11;
enterData(&soccerPlayer player[SIZE]);
}
void enterData(soccerPlayer player[], ifstream &fin)
{
string del;
for (int x = 0; x < SIZE; x++)
{
string name;
getline(fin, name);
player[x].name = name;
fin >> player[x].number >> player[x].points;
getline(fin, del);
if(player[x].number < 0)
{
cout << "\nInvalid Player's Number" << endl;
x--;
}
else if(player[x].points < 0)
{
cout << "\nInvalid Player's Points Scored" << endl;
x--;
}
}
}