You are on page 1of 4

Lab report 2

Anika Giuliana Schulz Charotti


ID: B02201022

On the second row we declared the library and then I prefer to put “using namespace std” so I don’t
have to write all the time “std::” when I want to print something. Then we put the main function “int
main”, opened brackets and in there we declared the variable that in this case is called
“Numberfolanguages” and we use the indicator “int” because we need integers number in there. On the
others rows we enter the structure to print “cout<<” , we put the message on it with quotes and close
the rows with a semicolon. Then we put “cin>>” that we would use to introduce the data.

We then write a loop creator “if else” this works by putting something on the “if” and if this statement
isn’t true the program would past to the “else” and print whatever is on there if that statement is true if
not the program would end. The same would happened with the “if”, if this is true the program would
print what is on it immediately.

The “return 0” is there to make us sure that the program works.


Lab report 2
Anika Giuliana Schulz Charotti
ID: B02201022

In this program we decelerated 2 variables with value and the 3erd one is the result of the sum to the
other 2. So at the end we print the result of the sum.

In this program we combine the sum and the multiplication of 3 diferent variables where the fourth one
is the result of the sum between the first 2 and then the multiplication of this result with the 3th
variable. Here one of the variables is a float, this mens that isn’t an integer number.
Lab report 2
Anika Giuliana Schulz Charotti
ID: B02201022

Here we declared 3 variables with integer values and another one that is the result obtained by
subtracting the biggest number with the smaller one and then divided by 2, this is the reason why we
obtain a negative number.
Lab report 2
Anika Giuliana Schulz Charotti
ID: B02201022

In this program the user have to put or assign 2 values for the variables and then the program would
sweep the values .

You might also like