First off, thank you for taking the time to read this.
Here is my question:
I am reading data in from a file that contains names for items that I will be placing onto a heap for use in a program.
The program gives me all of the desired data plus one more piece of data (not desired) with no name.
I can't seem to get my while (!eof) to work properly, and any assistance in this matter would be greatly appreciated.
ifstream dfile;
dfile.open ("batteries.dat");
while (!dfile.eof())
{
std::getline(dfile, name, '\n');
battery.key = 100;
battery.name = name;
batteries.insert (battery);
cout << "Battery " << battery.name << " with " << battery.key
<< "% charge"
<< "\nwas added to your shelf." << endl;
}
dfile.close();
Again, thank you for your time
Jim