I do not understand why this may be needed twice, this is a quote from a book that I am reading;
The cin.get () operator reads the next keystroke, so this operator makes the program wait until you press Enter. (No keystrokes are sent to the program until you press Enter, so as not to press another key.) The second statement is necessary if the program otherwise leaves the raw keystroke after its usual input. For example, if you enter a number, enter the number and press Enter. The program reads the number, but not pressing the Enter key is not processed, and then it is read first by cin.get ().
I put it in the source code and do not see that its point was there twice.
You enter some numbers and press Enter, this ends the program, only different - you press twice if nothing was entered before the end.
The point is to pause the program, and is that so why use it twice?
source
share