Header Files
C++ provides various header files, each containing the essential functionalities required for the program to work correctly.
We have already seen the input-output handling related to the <iostream> header file in the first C++ program.
#include <iostream>using namespace std;int main(){ cout << "Hello world!"; return 0;}
#include is used to add standard or user-defined header files to the program.
The <iostream> header file defines the standard stream objects for input and output data.
Namespaces
A namespace is a declarative region that provides a scope to the identifiers (such as variable names) inside it.
In our code, the line using namespace std; tells the compiler to use the std (standard) namespace.
#include <iostream>using namespace std;int main(){ cout << "Hello world!"; return 0;}
The std namespace includes the fundamental functionalities of the C++ standard library.
Printing Line Breaks
The cout object does not insert a newline character at the end of the output.
One way to print a line break is to use the endl manipulator, which inserts a newline character.
#include<iostream>using namespace std;int main(){ // endl causes a line break cout << "Hello world!" << endl; cout << "I love programming!"; return 0;}
Output result: 
Line Break Characters
The newline character \n can be used as an alternative to endl.
Depending on the program’s needs, multiple \n can be added in a single cout statement to print multiple lines of text.
Example:
#include <iostream>using namespace std;int main(){ // Directly using \n to indicate a line break cout << "Hello world! \n"; cout << "I love programming!"; return 0;}
The backslash \ is called an escape character, indicating a “special” character.
For example:
The given program outputs “C++”. Please modify the code to output each character on a new line.
Use the character \n to create line breaks as necessary.
#include <iostream>using namespace std;int main() { cout << "C\n+\n+" << endl; return 0;}