+ 10
Why do we write getch() in turbo c?
37 odpowiedzi
+ 3
No need when you are using int main , replace it by return 0.
It is used under header file conio.h specially to make programm stable means it remains on output screen till you
Press any other key......
+ 5
Basically its job to take one character from the keyboard
+ 4
Its use for holding prompt screen until any character press by the person.
+ 4
I would recommend to stop using turbo c++, it is not even updated for decades and it is non-standard !
getch() is a part of turbo c++, which is taught to us in schools. Now, I use codeblocks which has C++11/14 in it.
As an alternative to getch(), you have system("pause"), which is a function in cstdlib which you can include as,
#include <cstdlib>
Also you've used clrscr(), for that we've system("clear") in the same header file / library.
+ 4
It is used in some c compilers like turbo c.
Used to hold the output screen and wait until user press any key.
So, the screen remains stable, hence we can able to see the output on the screen.
[Just try the code without getch(), your output screen will just blink & go, you can't see or analyze your output]
+ 3
getch() is used in turbo c just to hold the screen to get the output to the user, which have a presence due to header file conio.h in library.
+ 3
Getch() us a character input which is used to take a character from the user at run time
+ 3
Well it does same thing like getchar() but the difference is getchar () echoes the character keyed on screen while getch() doesn't. And it is also used to hold the screen for output
+ 3
getch() is used to hold the output screen.
+ 3
getch mean get character it's requires for get output
+ 3
getch() function mean
To get a character
So,
At end compiler want a character
He waiting for a character
And
When you press a key then he got that character
And he over the program
+ 3
getch () function reads character from keyboard.
+ 3
getch ()
always get a character from user to hold the screen
+ 3
getch() is a way 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.
+ 2
getch() function is used in some c compilers and turbo c to hold up the output screen (i.e the screen waits until any input is given or any key is pressed)so that we are able to read the characters in our output
+ 2
By using this curser will remain on output screen until you press any key
+ 2
To hold the screen i guess
+ 2
For Holding screen
+ 2
We have to write getch() in the code for hold the screen, and we get seen clearly our answers.
+ 2
hold the screen & wait for single character from keyboard.