#include<iostream> basically incorporates the header file, iostream into your program. iostream is part of the C++ standard library, and by including its contents in your program, you are able to use functions, definitions and classes in that file. All the lines that start with a # are preprocessor directives. The preprocessor makes intermediate changes to your code that you never have to see, but that the final compiler will see. #include basically means copy all the code from this file (in this case, iostream) into my file.
Suppose we have a header file of our own that looks like this (we'll name it "MyHeader.h"):
Code:
int MyAddFunction(int a, int b) {
return a + b;
}
And then we include it in your hello world program like so:
Code:
#include<iostream>
#include "MyHeader.h"
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}
Basically, this tells the preprocessor to copy all the code from our header into this file. After the preprocessor does its work, the final compiler sees this:
Code:
/*The contents of iostream goes here, but it's way too long to post*/
int MyAddFunction(int a, int b) {
return a + b;
}
using namespace std;
int main() {
cout << "Hello World!" << endl;
return 0;
}
In essence, it's a way to virtually copy code into our source file without making the source file huge in the process, which makes code a lot more manageable. It's also handy when you want to use the same code in many different source files, which will be important in bigger programs. The reason the tutorial told you to include that file is because it contains the definition for cout (short for "console out", BTW), which you will use to print text to the console.