+ 8
Can we use printf scanf in c++?
If so then which header file do we need to use fir them? Please also tell the functioning of getch() in c++.
5 Antworten
+ 11
#include<stdio.h> us used for this.
getch() is a nonstandard function and is present in conio.h header file which is mostly used by MS-DOS compilers like Turbo C.
It is not part of the C standard library or ISO C, nor is it defined by POSIX (Source: http://en.wikipedia.org/wiki/Conio.h)
It read's a single character from keyboard. But it does not use any buffer, so the entered character is immediately returned without waiting for the enter key.
https://www.sololearn.com/Discuss/288609/?ref=app
+ 3
Yes, using <cstdio> (stdio.h), you can use printf() and scanf().
getch(), a C based function from the conio.h library (a library now considered deprecated as it is only supported by windows, and was never standardised), is used to read a character, whatever it may be, from the console. It can only read a single character, and is used in the following way :
char c = getch();
Note that the function takes no arguments.
This function should not be used in the present times, and you may replace it by cin.get();
+ 1
<cstdio> is to be used for printf and scanf.
getch() is used to hold the output as in some compilers, output isn't visible as it terminates.
Therefore getch() is used to hold the program so that we may see the output of program.
0
use stdio.h for printf and scanf
getch() is get character which reads a single character from thw keyboard but doesnt show up on screen and it is used with conio.h
- 1
Devendra Yadav,you did,nt accept my challenges???
challenge storm me!!