What is use of getch( ) and putch() | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is use of getch( ) and putch()

somebody told me its use is to print string name with spaces instead of using underscore with cin but some code have getch() at end . what that means , please give example too if possible I have viva on Tomorrow and I am lagging on module.

13th Nov 2016, 5:44 AM
Amandeep Singh
Amandeep Singh - avatar
2 Answers
0
getch() will get a character from standard input but doesnt display on the screen. getche() gets a character and displays on screen. putch() will print a character to standard output getch at the end is because if you dont use it, program will run, show output, and output console will close after that because program execution is complete. to wait for user to read the output, getch is must. program will close only after a key press in this case
13th Nov 2016, 6:48 AM
P Sandesh Baliga
P Sandesh Baliga - avatar
0
thanks bro
13th Nov 2016, 11:12 AM
Amandeep Singh
Amandeep Singh - avatar