As I started learning basic C++, I've always used the headings
#include <iostream>
using namespace std;
I want to question what is the point of iostream. Is it required every time as a heading?
This question is related to
c++
That is a C++ standard library header file for input output streams. It includes functionality to read and write from streams. You only need to include it if you wish to use streams.
#
indicates that the following line is a preprocessor directive and should be processed by the preprocessor before compilation by the compiler.
So, #include
is a preprocessor directive that tells the preprocessor to include header files in the program.
< >
indicate the start and end of the file name to be included.
iostream
is a header file that contains functions for input/output operations (cin
and cout
).
Now to sum it up C++ to English translation of the command, #include <iostream>
is:
Dear preprocessor, please include all the contents of the header file iostream
at the very beginning of this program before compiler starts the actual compilation of the code.
Source: Stackoverflow.com