Code:
fstream infile("hw5.data",ios::in);
info main_struct;
string line_string;
string fips;
string d_name;
string r_code;
int d_pop;
int sd_enrol;
int st_need;
getline(infile,line_string,'\n'); //read one before loop
while(infile)
{
parse_string(line_string,fips,d_name,r_code,d_pop, sd_enrol,st_need);
fips = "";
d_name = "";
r_code = "";
d_pop;
sd_enrol;
st_need;
cout << endl << endl << endl;
getline(infile,line_string,'\n');
}
I was taught to always read something before your loop, so this should also stop from reading and extra record