Here are a few questions to help you clarify your understanding of input.
For each of the code fragments below, show what happens when the user types this sequence of characters:
9+4uaq^-5*-7
That is, for each code fragment:
You should assume that each fragment is independent of the others (i.e. so each input begins at the '9' in the stream of input).
The type of the variables used is indicated by their first letter (c is char, s is short, etc.).
cin >> c1 >> c2 >> c3;
'9', '+', '4' no errors ends at 'u'
cin >> s1 >> c1 >> s2;
9, '+', 4 no errors ends at 'u'
cin >> s1 >> s2 >> s3;
9, 4, nothing stored error at s3, can't translate 'u' ends at 'u'
cin >> s1 >> s2 >> c1;
9, 4, 'u' no errors ends at 'a'
cin >> d1 >> d2 >> c1;
9.0, 4.0, 'u' no errors ends at 'a'
cin >> s1 >> c1 >> s2 >> c2 >> c2 >> c2 >> c3 >> d3 >> c4 >> d4;
9, '+', 4, 'u', 'a', 'q', '^', -5.0, '*', -7.0 no errors ends at '\n'