thank you for that and one last thing im trying to add up the salaries of the presidents i thought because their salaries come in as strings i could convert the strings to doubles and then add that salary to the total salary and it would do it for each salary it found but i get an error heres my code
1 2 3 4 5 6 7 8 9
while (getline (in, line)){ // using getline to read in a single line at a time
string id, firstname, lastname, salary;
istringstream iss (line);
iss >> id >> firstname >> lastname >> salary >> total;
Presidents person (firstname, lastname, salary, id);
sort.push_back (person);
double money = std::stod (salary);
total = money + total;
}
while (getline (in, line)){ // using getline to read in a single line at a time
string id, firstname, lastname;
double salary;
istringstream iss (line);
iss >> id >> firstname >> lastname >> salary >> total;
Presidents person (firstname, lastname, std::to_string(salary), id);
sort.push_back (person);
total = salary + total;
}