What each piece of code means

Preprocessor Directive: This is an instruction to the compiler to include a library of code that it compiles before it compiles the rest of the code.

Main Function: This is the main function that controls the rest of the code. Within the { } lies the main body of code that it will run.

Expression Statement: This is a statement that we output to the terminal, however, its definitive feature is that it ends in a semi-colon.

Declaration Statement: This is a statement that declares the value of something, like declaring the value of a variable such as, const int a = 9

Return Statement: This executes the end of a function, effectively stopping the code from running.

2 Likes

Great job doing the challenge l! If you keep this up you are on your way to becoming a gameplay programmer.

1 Like

Thank you! I really appreciate the encouragement!

The preprocessor directive includes the library that you use in your code.
The main function begins the code, and excludes the preprocessor directive becouse it does not interact with the terminal.
Expression statements do interact with the terminal, and end in a semicolon.
Declaration statements are similar, but specifially define the variables that can be used by the expression statements.
The return statement signals the end of int main, or the body of code, and will allow the terminal to tell us if the code is working.

Preprocessor Directive:
Refers to the libraries and premade code outside our own, that is being utilised by our code
Main Function:
Every C++ program needs one, it organises and executes the rest of the functions
Expression Statements:
Basically, all the stuff that is shown in the terminal, on the GUI or graphics, everything that is
expressed, that refers to and uses declared values is in these statements
Declaration Statements:
The lines of code that establish (declare) the values of variables
Return Statement:
The Main Function’s closing output

Preprocessor directive: This is the include statement that allows us to import libraries to be used in our program as Header files. It must be stated prior to being used in the any function.

Main Function: This contains all the code that is being run in our program. Here, no arguments are being passed in. The type int is specified as the function returns an integer, 0. I am unsure why this is the case or why 0 is not printed to the console upon execution though.

Expression statements: Here the expressions are strings that are then printed to the console to be read by the user as via use of the cout function in the std library, thereby forming expression statements.

Declaration statements: This is where we instantiate and operate on our variables in order to express them again later in expression statements

Preprocessor Directive: I believer gives an inference as to where the information accessed is located.

Main function: As the name stipulates is the crux of the code, without it nothing works.

Expression statements: Expresses to the frontend.

Declaration statements are values declared that validate the expression statements .

Return value: is what ends and/or wraps the code in a tight little bow. But provides the end value required to make the code work.

Pre-processor directive: I think that this is telling the compiler that we are using an external library
Main function: I think that this is what the compiler reads first, so we must include all things we want to affect the output in here, including calling other functions
Expression statements: I think that the expression statements are where we change things that will be outputted to the command window.
Declaration statements: I think that these statements are where we create and assign values to our variables
Return value: I think this is the value that the main function will output, without this the main function would not work

Privacy & Terms