// Zig Herzog
// Sep. 2, 2009
// integerMath.cpp : Introduce facets of math with integers and the cin object

#include <iostream>
using namespace std;

int main () 
{

   int i , j , k ;   // Declaring three memory spaces named i,j, and k
		     // whose content are to interpreted as integer
		     // numbers. Reserving 4 bytes of memory for each.
		     // i,j, and k are referred to as variables in the
		     // same sense as in mathematics.

   i = 2  ;          // assigning the value of 2 to variable i, meaning that
		     // in memory assigned by the compiler to variable i
		     // you now have stored the number 2 ( in binary format )

   j = 3  ;         

   k = i + j ;       // adding the values of i and j and assigning the
		     // value of the result to k
   cout << "i=" << i << "  j=" << j << "  k=" << k << endl ;

   i = i + j ;       // adding the values of i and j and assigning the
		     // value of the result to i replacing its original
		     // content   IMPORTANT, different from MATH
 
   cout << "i=" << i << "  j=" << j << "  i=" << i << endl ;

   cout << "Give me first integer ( + or - ) : " ;
   cin >> i ;

   cout << "Give me a second integer ( + or - ) : "  ;
   cin >> j ;

   k  = i * j ;
   cout << "i=" << i << "  j=" << j << "  k=" << k << endl ;

   // Math operators for integers :  +  -  *  /  %
   // Use parenthesis like in math  

   // Special assignments : changing the value on the spot
   // 
   //                       i++;      increases the value of i by 1
   //                       i--;      decreases the value of i by 1
   //                       i += 3 ;  increases the value of i by 3
   //                       i -= 3 ;  decreases the value of i by 3
   //                       i *= 3 ;  Multiplies  i by 3
   //                       i /= 3 ;  divides i by 3
   //                       i %= 3 ;  will become the remainder of the
   //                                 division of i by 3

}


Zig Herzog; hgnherzog@yahoo.com