+ 3

What is getch()

i dont know sir

25th Mar 2017, 3:55 AM
omjay
4 Respuestas
+ 30
I haven't seen use of getch() in c++ In C though.. it is used to get a char input from keyboard when you see the output...*I maybe wrong here* eg:- when the output of your code is 5 it will stay on the screen until you press any char from keyboard. It is used bcz the default output lasts for fraction of seconds and is not visible, so we sort of pause it.
25th Mar 2017, 4:04 AM
Frost
Frost - avatar
+ 4
getch() reads a single byte character from input. getch() is away to get a user inputted character. it can be used to hold program execution but the "holding" is simply a side-effect of its primary purpose, which is to wait until the user enters a character.
25th Mar 2017, 4:03 AM
Garvit Joshi
Garvit Joshi - avatar
+ 4
One interesting thing about getch() is that, unlike taking input from cin, it does not wait for the enter key to be pressed; the input is taken immediately. Also, as noted, it is not displayed on the screen.
25th Mar 2017, 4:22 AM
Squidy
Squidy - avatar
0
get() function for input single char
25th Mar 2017, 11:56 PM
Brahim Ferik
Brahim Ferik - avatar