Question: Consider the following code: cout < < Enter a number: ; cin > > number; cout < < Enter a character: ; cin.get
Consider the following code:
cout "Enter a number: ;
cin number;
cout "Enter a character: ;
cin.getch;
cout "Thank You!" endl;
When thecin statement reads in data the user entered, it stops when it comes to thenewlinecharacter Thenewlinecharacter is not read, but it remains in the keyboard buffer. This can be a problem if we do acingetimmediately after thecin Whatcinfunction do we need to include in order for this program to work properly?
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
