Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What The Difference between stdio.h and iostream? [duplicate]

Tags:

c++

#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?

like image 870
Omar Effat Avatar asked Feb 27 '15 11:02

Omar Effat


People also ask

What is the differences between header iostream and iostream?

If your implementation have a working copy of iostream. h, it is probably the same as iostream except that everything in iostream is in the std namespace, while iostream. h generally preceded namespaces, and didn't use them.

Why do we use iostream instead of iostream H?

Answers. iostream. h is deprecated and not a standard header. It was used in older programs before C++ was standardized, Functions like cout were defined inside iostream.

Should I use stdio C++?

YES WE CAN USE BECAUSE INPUT AND OUTPUT OPERATIONS CAN ALSO BE PERFORMED IN C++ ALSO. BECAUSE C/C++ USES WHAT ARE CALLED STREAMS TO OPERATE WITH PHYSICAL DEVICES SUCH AS KEYWORDS,PRINTERS TERMINALS OR ANY OTHER TYPE OF FILES SUPPORTED BY THE SYSTEM.

What is the difference between iostream and conio H?

Both are header file (they have there own coding specifically we can say they have the code for calling function), and those function in iostream. h is cin and cout(to take values from keyboardand print values on monitor) , while in conio. h(to use clrscr() in order to free the last o/p on the monitor screen).


2 Answers

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>

like image 118
Bas Avatar answered Oct 21 '22 03:10

Bas


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.

like image 28
Nick Suwyn Avatar answered Oct 21 '22 05:10

Nick Suwyn