Please HELP!! final due tomorrow


I am trying to write a program where you enter a football team's win/loss record and it displays the info by reading a txt file. P.S. I am using xcodes on mac. (sorry if its a little messy.

#include <iostream>
#include <fstream>
#include <string>


using namespace std;

void enterData();
void deleteEntry(string remove);

int main()
{
string remove;
enterData();

cout << "\nWhat team entry would you like to remove? \n";
getline(cin, remove);

deleteEntry(remove);


}


void enterData()
{
string name;
int wins, losses;

ifstream fin;
fin.open("football.txt");
if (fin.is_open())
{
while (isalpha(fin.peek()))
{
getline(fin, name);
fin >> wins;
fin >> losses;
fin.ignore(5, '\n');
cout << "\n" << name << "has " << wins << " wins, and " << losses << " losses.\n";
}
fin.close();
}
}

void deleteEntry(string remove)
{
string nameTeam[100];
int x = 0;
string name, wins, losses;

ifstream fin;
ofstream fout;
fin.open("football.txt");
if(fin.is_open())
{
while(!fin.eof())
{
getline (fin, name);

if (name != remove)
{
nameTeam[x] = name;
x++;
getline (fin, wins);
nameTeam[x] = wins;
x++;
getline (fin, losses);
nameTeam[x] = losses;
x++;
}
else
{
getline (fin, wins);
getline (fin, losses);
}
}
fin.close();
}
fout.open("football.txt");
if (fout.is_open())
{
for (int i =0; i < x; i++)
{
fout << nameTeam[i] << endl;
}
fout.close();
}
return;
}




// displays after entering in .txt file Patriots 10 3
//Patriots 10 3has 0 wins, and 0 losses.

//What team entry would you like to remove?
my fault, i entered in the txt file,
Patriots 10 3
instead of
Patriots
10
3
Topic archived. No new replies allowed.