Section 2 explaining different parts of the program

#include is a preprocessor directive that imports code written by other developers (classes or methods?). That way we can use those classes/methods, e.g. std::cout.

Every program must contain one (and only one?) main function. This is used by the compiler to find the code and execute it.

The expression statements (in this case) allow us to print things to (cout) and write (cin) in the terminal.

The declaration statements simply declare variables. In this case integer-variables.

The return statement returns a 0, indicating that the program ran as it should (I think).

Privacy & Terms