scanf in c++

How to use scanf in c++ ? which header file i need to include when i am including conio.h it says no such file or directory!

i am using ide codeblocks latest version!
Last edited on
You don't want conio.h. If you are using latest version of codeblocks, it probably means that you have MinGW as your compiler... MinGW does not contain <conio.h> as one of its header files, due to being a non-standard header.

For scanf, try #include <cstdio> , this should provide you with all the C-Style input and output functions.
Last edited on
Here is the documentation on scanf.
http://www.cplusplus.com/reference/cstdio/scanf/

1
2
3
#include <cstdio>
//  or
#include <stdio.h> 
We presume you have a really good reason for messing with scanf() in C++.

You are much better off just using the proper extraction operators.
@Duas
Yes i have really very big reason ,in long test case, as scanf will consume lesser time wrt to cin
A common fallacy. Particularly in modern compilers.
Topic archived. No new replies allowed.