What does our preprocessor directive do?
It tells the compiler to insert the code stored in the header file <iostream>
this allows us to use the functions and variables declared in this header such as std::cout
or std::endl
Why do we have a main function? What does it’s return value do?
Because otherwise our C++ program would have no steering function for the operation system to execute. The return value is the code the program sends to the OS that tells it if the process was successful <=> return 0;
or unsuccessful <=> return 1;
Explain our expression and declaration statement that we have written so far, to summarise what our program is doing.
The first three non-white-space lines in our main function are expression statements that output the outline of our story. These are followed by five declarative statements where we define a set of constant variables and their values. And lastly, the two lines above the return statement are expression statements again that output the values of the sum
and product
variables declared above.