We start with #include <iostream>
which is a preprocessor directive that is the first line in our file that the compiler reads. It includes or makes available to us code that someone else wrote in the <iostream>
header file so we can use it in our own code.
Then we have int main()
which is a required function in C++ that acts as the entry point for the program (i.e. the program starts here).
Then we have our expression statements using std::cout
(cout in the std namespace) these are used to print information to the console. We use std::endl
to force a new line after the statements. Otherwise they will all appear on one line.
Then we have our declaration statements const int a = 5;
with this we declared an integer variable named a, and initialized it with a value of 5 we also used the const keyword to tell the compiler that the value of this variable should not change!
After the last expression statements we have return 0
which just tells the compiler that the program ended successfully.