#include<stdio.h>
int main ()
{
// code
}
return 0 ;
#include<iostream>
int main ()
{
// code
}
Which library is best to use?
What is the best and why? And when I code what is the difference in function between them?
#include<stdio.h>
int main ()
{
// code
}
return 0 ;
#include<iostream>
int main ()
{
// code
}
Which library is best to use?
What is the best and why? And when I code what is the difference in function between them?
stdio.h
is the header file in the C standard library. It is used for input/output
iostream
is the input output class in C++
So if you're using C++ just use #include <iostream>
First off, iostream
is part of the C++ standard library, and stdio.h
is part of the C standard library. While stdio.h
will work in C++ it does not provide everything that iostream
includes as iostream
is specifically for C++.
Here is stdio.h
documentation.
Here is iostream
documentation.
iostream
is the C++ header for the input / output classes and objects (std::cout
, std::cin
...).
stdio.h
is the C header for printf
, scanf
, ... (in C++, stdio.h
became cstdio
)
In C++, you are not supposed to use it, use iostream
instead.