Code explanation

The preprocessor directive brings in pre written code into our program so we can use it. It will contain the code for further functionality. I think iostream is code for input and output streams.

The main function is where the program begins when it is run. This is where most of the “work” is done as far as running your code. You can run other functions by calling them in the main function.

The expression statements in this case is what we see when the code is running. Because we are using iostream as a preprocessor directive, these statement produce an output, and later we can also have user input.

The declaration statements identify and define variable and constants. These statements basically create a “container” we can add a value to.

The return statement marks the end of a function. In this case our function is an integer so we return 0 which is an integer.

I think I have all this right. But maybe not. Up until now I have been trying to teach myself with YouTube videos here and there. So somebody please correct me if I have anything wrong.

Privacy & Terms