Fun with numbers

Hello.

In this post I will show you basic math operations. Here’s the instructions:

  • The difference of the two numbers.
  • The product of the two numbers.
  • The integer based division of the two numbers (so no decimal point). First divided by second.
  • The remainder of integer division of the two numbers.

And this is the code:

numeros

It is a basic structure to have the difference, product, integer division and ramainder. As you can see I used variables. The variable tells the compiler where and how much to create the storage for the variable (http://www.tutorialspoint.com/cplusplus/cpp_ variable_types.htm).

The basic variable of Integer numbers is INT. As you can see in the image you have to write next to INT the variables that you want to use. In this case we have 6:

  1. num1
  2. num2
  3. resta
  4. producto
  5. division
  6. residuo

But now we are using CIN. The opposite of COUT. We have to use it when we want to ask to the user for values and put it here:

numeros1

Under the COUT.

Then we write the operations with the respective variable.

Finally COUT is used to write the final message. To present the variable you have to write it between << variable << and it will show up the answer.

 

Thank you for see my post! See you Later.

 

CC BY-SA 4.0 Fun with numbers by sercho93 is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.