I just want to read sign character from user and after this ask whether he/she wants to repeat.
it is something like this:
cout << "Please now enter the sign (+-*/): ";
cin >> *sign;
cout <<endl;
and after some time:
cout << "Do you want to try again? (y - yes, anything else - no): ";
cin >> *yn;
problem is that if user enters something like "+t" in the first time then 't' is automatically assigned to the second yn character.
So how I can prevent this?
question from:
https://stackoverflow.com/questions/65952010/how-to-stop-my-code-from-reading-next-character 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…