I have a program that take commands from user and it will process different commands differently. For example:
ADD_STUDENT ALEX 5.11 175 ADD_TEACHER MERY 5.4
Do it like so:
iss >> command; if (!iss) cout << "error: can not read command\n"; else if (command == "ADD_STUDENT") iss >> name >> height >> weight; else if (command == "ADD_TEACHER") iss >> name >> height >> weight >> salary; else if ...