Explain our code so far in Triple X!

The preprocessor directive copies contents of the iostream header file into our code before the rest of our code is compiled.

Expression statements are expressions that end in a semicolon;.
Declaration statements declare some data.

Return functions signify the end of a function - they return a value from the function.
Main functions allow our code to compile and execute.

The preprocessor directive copies all the necessary functions in the isotream.h file to make the code work.

The main function is used to describe exactly what the program does.
The return statement is necessary because C++ needs a return value to work.

Expression statements is an expression followed by a semicolon.

Declaration statements declares values in variables/const.

Preprocessor directive: This is where we can include libraries of codes into our own code.
Main function: This is the part that runs the core loop of the code.
Expression statements1: This is where we added text for the program to read out into the console.
Declaration statements: This is the part we declare variables for later use in the code.
Expression statements2: This part is where we used the declared variables to read them into console.
Return statement: This closes the program.

  • Preprocessor directive
    It allows to add code made by other persons to our code and it has to be at the begining of our code before the main function

  • Main function
    All the code inside the main function because the compiler will look for this function and execute everything inside of it

  • Expression statements
    This are used to make as it name says expressions, every expression followed by a semicolon is an expression statement

*Declaration statements
This are used to declarate things, so far we have only use it to declarate our variables

*Return statement
This is what will tell us if everything is working, is return 0 because at the end the compiler will check out if the value return by our program is 0 if it isn’t then there would be an error.

Preprocessor Directive: This gives instruction to the compiler. In our case: #include is going to include a library (iostream) before compiling.

Main() Function: This code is the core of our code that is run. It’s where the execution of our program starts.

Expression Statements: These are expressions followed by a semicolon.

Declaration Statements: code that declares something such as a variable declaration or a constant declaration.

Return Statement: Terminates the execution of a function and returns control to the calling function.

The preprocessor directive needs to pull data elsewhere before the following piece of code can operate without any errors. In this case specifically our preprocessor directive line will pull a preexisting code that has functions allowing us to print data onto our terminal.

declaration statements: (i think) will decide the existance of something, it can decide that for instance a variable with an integer will be created with a preexisting value
In terms of our game it will create data that our expressions will pull from for reference

Expression statements: will ask our data to perform a task. (std::cout <<) means “print x to terminal”, while a = 2 means “the value a must become 2”, rather than “the value a is 2”

The main function will tell you what needs to happen once this function is called (allowing things to come beforehand), it will also end (return 0) which tells you that the code run successfully

Preprocessor directive allows us to use code created by other developers, and access to libraries.

Main function allows us to run our code.

Expression statements is an expression followed by a semicolon.

Declaration statements are code that are declaring something(ex. Variable).

preprocessor directive codes are someone elses codes that we need to use in our program. We can usethem with typing #include command.

We do have main function because the code starts reading main function first.

Expression statements are expressions with semicolon. They affect the terminal.

Declaration statements are usually variables.

Return statement returns a number for the main function.

It tells the compiler to load the iostream library, which will then be used in order to receive input and send output from and to the terminal.

The main function executes when the program starts, so we must always have a main function in our program, and it must also have a return statement. The return statement tells whether we had a success or a failure in our program. 0 means success, any other value means failure.

In the first expression statements we output a message, in the declaration statements we set up our constants, and in the final expression statements we use our constants to output some of them.

Preprocessor includes libraries which have predetermined functions to use in our codes. Compiler checks these in the start.

Main function is the start of all c++ codes and always needed for the code to work.

Return statement returns a number to the operating system (?). if it is 0 there were no errors. any other number is an error in program.

Expression statements are slightly unclear for me, but basically expressions in the code.

Declaration statements seem to define variables.

Preprocessor Directive: The pre-processor directive provides the code that allows the user to code in C++ properly.
Main Function: Similar to Unity CSharp but unlike CSharp, is mandatory for the code to work.
Declaration Statements: Declares something in the code, like variables or constants.
Expression Statements: Declares something to express in the code.
Return: When the function provides a number to the rest of the code. In this case, it closes the program.

Preprocessor directive: includes code that other people have written prior to the main function

Main function: contains all the code, tells complier where to begin compiling.

Expression statements: outputs things to the user

Declaration statements: declare variables and the value attached to them

Return Statement: ends the program and exits

TripleX.cpp

Preprocessor Directive:

  • This typically tells our program to include code from other libraries that allows us to use input/output functionality in our Terminal/cmd

Main Function:

  • A primary function where code instructions are executed.
    If the cpp file is compiled and ran, it will execute the code inside this function. Note we can have other functions outside of Main, but they must be called inside of Main for their code to be executed
  • Lastly The Return statement exits the function, typically the statement is associated with a value of the same type as the one that the function is defined as. In this case it will return a value of type int. The 0 is likely an arbitrary value.

Expression Statements:

  • Expression statements are instructions that mostly serve display code and end in a semi-colon. In our case we use it to print values to the terminal

Declaration Statements:

  • Instructions that serve to initialize, declare, re-assign, or evaluate code. Often contain assignment operators.

How’d I do? :smiley:

What does our preprocessor directive do?
It includes library of functionality that our code requires.

Why do we have a main function? What does it’s return statement do?
The main function is notifying the compiler the entry of our code to C++, return an integer for example a 0 when there is no error in the execution of the program.

Explain our expression and declaration statement that we have written so far, to summarize what our program is doing.
expression statements can be statements in the program without a declaration of a data type and ends with " ; " .
declaration statements includes data type declaration to variables, and ends with " ; ".

I believe:

Preprocessor Directive: A set of commands (in the form of a header) that are loaded before the program executes

Main: The start through to end of the program. The middle can call upon other subroutines making the remainder of the product accordingly.

Expression Statements: An to opportunity to use the code to ‘express’ something. ie: outputting text, or potentially moving something on screen…

Declaration Statements: Declaring of variables and values if applicable (maybe more?)

Return Statement: What happens at the end of the program. (ie: Return 0 ends the program with no errors.)

so, so far

preprocessor says to our program to get someone else’s code into our code if want to use it…

main function is what a program will be looking for at start… so it is kinda a structural component of code.
and return statement signals out that we are at the end of a program

our expression at first talked to our User (lets use Iron terminology here) and welcomes him into the game, then it shows our user variables that we declared with Decloration Statements for him

Privacy & Terms