It sounds like the same or similar problem as scanf() in C: It throws up on bad data but doesn't actually
discard the bad data.
In C the usual approach is to read strings line-by-line with fgets or getline (fgets preferred because there's some
very broken getline implementations out there), then feed the line into
sscanf. Whether sscanf succeeds or not, the data is out of the input stream and out of your way.
C++ doesn't have special string-only functions, it uses
stringstream to make a string act like
ss>>var>>var; instead. Whether reading your vars from the string succeeds or not, the data is out of cin and can't come back to haunt you.
Here's an example.