Explain our code so far in Triple X!

Preprocessor Directives: This is what you use when you need to include code/coding shortcuts from outside the main “dictionary”. It adds different coding libraries so that the computer will understand the terminology you’re using.

Main Functions: This starts the whole program and without it you would just have a blank terminal or even an error statement. It’s the heart of the code, and where the computer would look first to give you an output. These are required.

Expression Statements: Our expression statements in this case are probably the meat of the code. They are the lines that send input to the computer and tell it to do things, whether you see that in the output or not. (e.g. “MyVariable = 12;” is an expression statement just like “std::cout << MyVariable;” is)

Declaration Statements: These are mainly used as reference statements. They can declare and initialize things such as variables. (e.g. “MyVariable = 7;”)

Return Statements: You should never actually see this come up in your output. If it does, it means you have a coding error and you need to tweak your code. It’s basically a safeguard.

preprocessor directive instructs the compiler to add the library before compiling. We have the main function because every c++ program requires it and it is an entry point to the program. The return function tells the compiler any returning number other than zero will result in an error it is also used to exit the program. The expression statement is an expression that ends in a semicolon and a declaration statement declares something and in our case, it is the variables.

  1. What does our preprocessor directive do?
    A. It directs to a header file and loads all the functions of that class so we can use it

  2. Why do we have a main function? What does it’s return statement do?
    A. Main function will run all the code beneth. Return lets u know if your code was run sucessfully or not.

  3. Explain our expression and declaration statement that we have written so far, to summarise what our program is doing.
    A. Declaration is where we declare our variables and expression is where we run a function.

  4. We used expresion to print a string.

  5. We declared few int variables such as a, b, c. We also declared the sum and the product of these variables by using * , +.

  6. we used a method to print the values of these variables

  7. we put the word const infront of the variabls to protect them from changing their value.

The preprocessor directive fetches codes from an online library, so we can use stuff like cout and cin.
The main function is where c++ starts running the code.
Expression statements are things that are being displayed to the user.
Declaration statements are variables that are being assigned some values.
The return statement is making sure that the code has run in its entirety.


  • our preprocessor directive includes specific library of functions in our code so we can use it, and don’t have to write everything from the scratch.


  • Our main function executes our program and it is used as a body. It’s return statement tells the compiler that the program has run as it should, cause if there is some problem with the code so far, the program won’t reach end statement?


  • With the expressons, we are expressing something that is just there or is stored somewhere, and with the declaration, we are reserving and storing something in computer memory to be called out later.

The preprocessor directive imports a library that allows us to use functions which prints stuff on the terminal.

All programs have a main function and is the first function the program checks when compiling, since it is a function, it expects to return a value, and the value 0 is used for saying the the program ran without issues.

The expression statements are used to give instructions to the user on how to play the game and deliver hints on regarding what the numbers are.

The declaration statements hold the values of the random numbers and the values of the hints that are given.

In my opinion;
The Preprocessor Directive : It is allowing us to use libraries by importing them
Main Function : It is like the skeleton of the human body, it creates environment for us to use our code in it.
Expression Statements : We can express what we are doing in our codes with the help of expression statements. We can see the “picture” of our codes in terminal, or in the our finished program by the help of expression statements.
Declaration Statements : We can declare what we are doing in our codes, we can declare and decide the details with the declaration statements.
Return Value : Since The main function is a function, it has a return value. If return value is zero, we can understand that our code is running with no issue.

So think about a painting, preprocessor directive is the shop which we can obtain materials from it for our painting, main function is the frame of our painting, expression statements is our brush movements, suns, trees and etc. of our painting, and declaration statements is the types of paints, colors we choose, brush sizes etc.

The pre-processor directive does?

loads a certain library of code within your code which saves you time making up the code yourself.

Why do we have a main function? What does it’s return statement do?

its the start of the code without it wont run when its complied. The return statement sends a 0 if the code had no errors but if it did you would get some sort of error.

Explain our expression and declaration statement that we have written so far, to summarise what our program is doing.

we give our variables a value
and we declare the variables a, b, c with sum and product and return 0 to find any errors.

The main function is the core of the program. This function will call all the other one we need our program to work. The return statement is here to tell the computer if the program ended correctly or not. This is used to get something like error code, I guess.
The preprocessor directive is here to tell the compiler to include external code we’ll need for our program. This one is used to handle our inputs.
Declaration statements are used to get memory space were we can stock our variables, const means that those ones are not mean to be changed later. Expression statements finally are here to print messages to the player and get the input so we can compare them to our variables.

#include is loading codes from another library
Main function is need to compile the code and return is to say the function has no errors
expression statements are statement to give lines of text
while declared statements saying what things are.
our program is giving us a scenario while adding and multiplying integers to give us sum and products

Preprocessor Directive: loads the necessary tools/library for the program to run and adds it to the code for compiling. in this case ‘iostream’

int main() Function: The main function of the program, it begins and ends here.

Return Statement: Return 0, an integer, thus when this happens the program works and is O.K to run. I find this interesting since why not return 1, or 2. possibly has to do with the computer language of 1’s and 0’s.

Expression Statements: followed by a semicolon, expression statements are different kinds of expressions for the computer to read, either to print out or otherwise.

Declaration Statements: Declares any type of input necessary for the program to run according to your liking. They must be stated and viewed by the compiler to read as a certain type of information. Thus we include the int or const int.

My Question is: Can a declaration statement be considered an expression-declaration statement, since in the video we showed one example of “cout”, understandably it is an expression statement since followed by semi colon, and also prints to the terminal although not necessarily. But the “myVariable = 5;” is considered an expression statement as well, but of coarse it was declared at the start as “int myVariable;” which is an aspect of declaration.

What does our preprocessor directive do?

It loads library before the code is even compiled

Why do we have a main function?

It’s like the skeleton of the code, without it the program won’t start at all

What does it’s return statement do?

It says if we wrote correctly our code. We’re stating that return = 0 so if it returns anything but 0 there’s clearly an error.

Explain our expression and declaration statement that we have written so far, to summarise what our program is doing.

First we wrote some lines of text, then we’re declaring our variables(in this case they’re constants). Lastly we’re trying to write our values using the variable sum and product!

What does our preprocessor directive do?

It includes access to another library so we can use functions from that library. For this directive we are using functions that allow us to print to the console. It also allows us to get user information from the console.

Why do we have a main function? What does it’s return statement do?

The main function is what the executable runs. The return statement gives the computer feedback so the computer knows the function is finished. When it gives the computer the code 0 it knows it was successful.

Explain our expression and declaration statement that we have written so far, to summarise what our program is doing.

The first expression is writing two sentences to the console. They are separated into a new line with the expression std::endl. The declarations are declaring new constant integer variables and initiating values to them. The second group of declarations are declaring variables that add the previous variables together and multiplies the previous variables together. The second group of expressions are printing those variables to the console.

The preprocessor directive instructs the compiler to copy the code from iostream into our program before compiling.

The main function is the primary working function of the code. This is the starting point of the code and will run in order all statements and functions that are called in the main function code.

The expression statements are expressing the code to the terminal as directed in the statement. The semicolon at the end of each expression make it an expression statement.

The declaration statements are initializing our variables, be them constant or not.

The preprocessor directive its including a library of reference code without having to write it.
The main function makes the program run
The return statement allows the program to determine if the code is working by returning a specific value to the coder. If code is wrong an error code will display
The expression statement is code followed by a semicolon and represents the part of the code that some action is taking place?
The declaration statement is code the defines specific parameters within the code.

The preprocessor directive allows us to call onto another library of code to borrow within in program that we are writing. We include this at the very beginning of the code so that when the code runs, it knows that we are using lines of code that have been borrowed from another source in the code library. The main function serves as the protocol for making our TripleX game work and where we write all of the code inside to make our game come alive. Without a main function, our game would not be able to run at all. The expression and declaration statements serve to build the visual structure of our game such as printing on screen messages to the player and then declaring variables that change over the course of game’s progression onto harder levels.

Preprocessor Director: Its taking a code library and having use have access in our code.

Main Function: Contains the meat of the program, and tells the compiler the way to read the code

Expression Statements: Showcase strings and outputs data to read

Declaration Statements: Where all values expressed are initialized and understood by the compiler.

Return statement: Returns 0 if code does not fail and is a fail safe if anything goes wrong in the code.

Preprocessor Directive: Allows code from other libraries to be included and read before the code is compiled.

Main Function: The main function is required by every program in order for the code to run.

Expression Statements: Expressions that end with a semicolon./

Declaration Statements: Statements where variables and values are declared.

Return Statement: Returns an integer, a return value of 0 means the code was run successfully, any other return value results in an error.

Preprocessor Directive
Imports data from elsewhere into your code. This is performed before your code starts.

Main Function
Runs your combined statements as one unit.

Expression Statements
Statements that do not set or declare variables. Ends in a semi-colon.

Declaration Statements
Statements that set or declare variables. Ends in a semi-colon.

Return Statements
Returns a status or value back to the computer. Ends in a semi-colon.

The preprocessor directive tells the compiler to add code written by someone else on top of our code.

Every program must have main function. It is what the computer looks for to begin running the program. The return statement in the case of our main function returns the integer 0 to let us know that there are no errors.

Expression statements are expressions and are ended with a semicolon. The expression statements so far are sending information and instructions to the console. They use the iostream we included to show strings and variables to the console and instructions on when to end a line.

Declaration statements declare variables. So fare we have used declaration statements to declare and assign constant integers to our three variables, to declare and initialize a variable with the sum of those numbers, and to declare and initialize an additional variable with the product of those three variables.