Why #include <iostream> instead of #include<stdio.h>? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why #include <iostream> instead of #include<stdio.h>?

7th Feb 2016, 1:05 PM
ali khan
ali khan - avatar
2 Answers
0
#include <iostream> is a compulsion to use as it is a header file without which your program execution will be incomplete. actually iostream stands for input output stream which signifies the use of cin & cout in the program.
10th Feb 2016, 9:01 AM
Riya
Riya - avatar
0
I understood your question as: why not use the declarations from stdio.h instead of iostream? iostream is the C++ stream library header, which declares the C++ way of dealing with (text) IO. stdio.h is the header that provides the C-style function declarations. Trying to write readable, proper C++ code you should use iostream. Nevertheless, the functions from stdio.h are sometimes a bit faster... Therefore, as long as, say, 10% IO performance are not relevant, include iostream, otherwise include stdio.h.
15th Jun 2016, 8:37 PM
Stefan
Stefan - avatar