GetChar is a library function in stdio.h that reads a character from the stdin stream, which means that if stdin has data, it can be read directly without input. The Getch () and Getche () are library functions in Conio.h, which is the function of receiving characters from the keyboard.
getch () is actually an input command that receives a character from the keyboard and does not display the character, that is, after you press a key it does not display what you press on the screen and continues to run the following code, so we are in C + + You can use it to achieve the "press any key to continue" effect, that is encountered in the program Getch (), this line of statements, it will suspend the program, and so you press any key, it received the word keys and then continue to execute the following code.
You may ask why we did not add getch () to the end of the program in C + +. Explanation is that the software is always updated, the bad place of course to be corrected, getch () added at the end of the program, it does not assign value to any variable, so it is in this place is completely garbage code, unrelated to the program. Taking this into account in C + +, so every time the program runs out, it automatically stops the screen, and displays "Press any key ..." to call you to push any key to exit, which is like C + + in its environment to run the program, at the end of the program automatically add a line of getch (); And before this line statement also added a line of output statements cout<< "Press any key ..." to prompt you to end the program, pressing any key to continue.
Getche () and Getch () are similar, it also needs to introduce header file Conio.h, what is the difference between them? The difference is that getch () has no return display, Getche () has a return display.