I am new to c++ programming, first class this semester, could someone help me determine why this block of code is causing my program to hit an unexpected error and terminate when ran? This is a smaller chunk of a larger program, it at least makes it to the while loop but thats all i could figure out. Thank you in advance for any help:
void loadPresidents(bag& bagOfPresidents){
ifstream inFile("PresidentDataBase.txt");
if(! inFile )
cout << "File not found" << endl;
else
{
cout << "File found!!" << endl;
string number, name, bdDates, dtOffice, dlOffice, party, pOffice, vPresident;
while(inFile.eof) // while not end of file
{
getline(inFile, number);
getline(inFile, name);
getline(inFile, bdDates);
getline(inFile, dtOffice);
getline(inFile, dlOffice);
getline(inFile, party);
getline(inFile, pOffice);
getline(inFile, vPresident);
bagOfPresidents.add(Presidents(number, name, bdDates, dtOffice, dlOffice, party, pOffice, vPresident) );