tracing an end of line

i was asking to get an input from user, eg. 12 -8 7/8 6 D. Valid input is type of whole number and fraction, and D marking end of input.
i'm doing the input validation. if there is an error input, eg. 4 92 1/2 +6 55 14 D, where +6 is an error input, break from the reading and go back to ask the user to re-input again.

i'm using cin to get the input. if the program encounter an error input, it will re-asking the user again, but before the user typing some input, it still read the previous input, the one after the error input, because it was missed by the "break;"

so i'm trying to do like this,

if(!valid)
{
while(input[0] != '\n')
{
cin >> input;
}
}

hoping that if there is an error input, the program will still read the misses input until no more input, ie. end of line, but do nothing to it.