Why do we use getch() in c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do we use getch() in c++

29th Nov 2016, 4:29 PM
vijayalakshmi
vijayalakshmi - avatar
4 Answers
+ 2
getch() is used to make the console wait till a key is pressed. If placed at the end of the program, getch() make the output window to hold till a key is pressed.
29th Nov 2016, 4:54 PM
Varun Goyal
Varun Goyal - avatar
+ 1
Varun Goyal what you said is actually the half use of it. getch() is primarily used to return the ascii code of the key pressed as it is a function with a return value and not void. So actually for returning this value it has to keep waiting untill any key is pressed.
29th Nov 2016, 8:33 PM
Mohammed Maaz
Mohammed Maaz - avatar
0
To make the screen of outbuts remain const
29th Nov 2016, 5:16 PM
Ragheb
0
thanks, to all those who answered my question
30th Nov 2016, 2:36 PM
vijayalakshmi
vijayalakshmi - avatar