Explaining our code

Preprocessor Directive: This is the code that isn’t executed at runtime, but ensures that the IDE includes the correct information at compile tiem. In our case, this includes reference libraries of pre-written code, a subset of which we will be using in our code.
Main Function: The method that C++ needs to actually run the program. The output of the method is an integer.
Expression statements: These lines of code tell the program what to do. In our case, write information to the console.
Declaration statements: These tell the program to reserve some memory for the named variables. In our case, we initialise the variables at the same time.
Return statement: Indicates the end of processing for the method and, in this case, returns an integer value of 0.

Privacy & Terms