I have an assignment that needs me to read data from a file, i figured how to do it, however, when i add another name to the file, it just goes to ****...
here's the first file that i can read fine:
Mickey Mouse 45 78 91
Minnie Mouse 95 92 88
Donald Duck 72 81 89
now if i add a name everything gets messed up, for ex:
Mickey Mouse 45 78 91
Minnie Mouse 95 92 88 Random Name
Donald Duck 72 81 89
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
while (!fin.eof())
{
fin >> fname >> lname;
fin >> a >> b >> c;
if (fin.get() == '\n')
{
cout << fname << " " << lname << " " << a << " " << b << " " << c << " " << endl;
}
else
{
cout << fname << " " << lname << " " << a << " " << b << " " << c << " " << endl;
}
}
I know I'm missing something, but I can't quite get it. Any help would be appreciated.