scanf in c++

Oct 12, 2013 at 9:12pm
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 Oct 12, 2013 at 9:12pm
Oct 12, 2013 at 9:52pm
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 Oct 12, 2013 at 9:52pm
Oct 13, 2013 at 3:51am
Here is the documentation on scanf.
http://www.cplusplus.com/reference/cstdio/scanf/

1
2
3
#include <cstdio>
//  or
#include <stdio.h> 
Oct 13, 2013 at 4:00am
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.
Oct 14, 2013 at 4:59pm
@Duas
Yes i have really very big reason ,in long test case, as scanf will consume lesser time wrt to cin
Oct 14, 2013 at 5:45pm
A common fallacy. Particularly in modern compilers.
Topic archived. No new replies allowed.