If I am prompting the user for two chars, in order, for different parts of the code, and the user inputs two characters the first time, the next character stores into the second char.
For example:
//segment
char a, b='y';
cin>>a;
if (a=='n')
cout>>"this is n";
while(b!='f')
{cout<<"type the letter f";
cin>>b;}
//end segment
If the user is prompted for a, and types nf, the pregram will ask for b, but the input is already there: it is f, so the user never actually inputs b.
This is useful in some instances, but for others, like the one above, it can be annoying, especially if there is a lot of code between the two cins.
Is there a way to make the program not care about the input after the iniitial character?