#include <iostream.h>

void main()
{
  int x;

  x=3;             //now x contains 3

  cout << x << endl; //the value of x (which is 3) gets printed on
	             //the screen

  x=2+6;           //8 gets stored in x

  int y;
  y=2;             //2 gets stored in y
  x=y;             //what's in y gets copied into x (so x holds 2)

  cout << x << "   " << y << endl;   //2  2  gets printed on the screen

  x=3+y;           //add 3 to what's stored in y, put the result in x
                   //(so x now contains 5)

  x=4+x;           //add 4 to what's in x, put the result back in x
                   //(so x now holds 9)

///////////////////////////////////////////////////////////////

  //RULE FOR NAMING VARIABLES: it must start with a letter and can
  //then be followed by any amount of letters and numbers; for these
  //purposes, the underscore character ("_") counts as a letter; ALSO,
  //cannot use words that have a built-in meaning (like "void" or "main")

  //examples of legal names:

  int z,i,j,v,n;  
  int years, age, days, SCORE, bMarked, ooo, QuietMode, wIlD;
  int tiger_years, fahrenheit_to_celsius, _loop, __secret, _FOUND_, _;
  int m4, x0, twenty2, here2there, thx1138, _222, ddk234k21lj2h4;
  
  //examples of illegal names:

  //int 4theroad, 9_to_5, 1fg56;    //can't start with a number!
  //int int, void, main, char, float, double, static;  //keywords
  //int green$, one-on-one, you&@*$&!, ^spot, djdas%fda;  //illegal symbol

///////////////////////////////////////////////////////////////

  //tracing through a program and keeping track of the variables

  int u, m, junk;           //     u    |    m    |  junk
                            //  ----------------------------
                            //     ?    |    ?    |   ?
                            //          |         |
  u=2;                      //     2    |         |
  junk=-4;                  //          |         |   -4
  u=3*5;                    //    15    |         |
  u=junk+7;                 //     3    |         |
  m=u+junk;                 //          |   -1    |
  m=junk*(-2);              //          |    8    |
  u=5+u;                    //     8    |         |
  junk=2-junk;              //          |         |    6
  u=4+m+2*junk;             //    24    |         |
  m=u-(junk+4)*2;           //          |    4    |


  //NOTE: variables only contain one value at a time; when a new value
  //put in, the old value is completely forgotten

///////////////////////////////////////////////////////////////

  //basic math operations

  x=y+4;    // use + for addition
  y=5-z;    // use - for subtraction
  z=2*x;    // use * for multiplication
  x=y/2;    // use / for division

  x=73%5;   // use % for modulus

  //modulus is the remainder after division; it is frequently used
  //in programming, but doesn't occur often in math classes
  //
  //consider long division, like in grade school:
  //
  //           14  r 3
  //         ---------
  //       5 | 73
  //           5
  //           --
  //           23
  //           20
  //            --
  //            3     <----- remainder (= modulus = 73%5)

///////////////////////////////////////////////////////////////

  //shortcuts (special shortened notation)

  // shortcut             meaning
  //---------------------------------
     int w=5;            // int w;
                         // w=5;

     int a=3, b, c=90;   // int a,b,c;
                         // a=3;
                         // c=90;

     w+=6;               // w=w+6;
     w-=2;               // w=w-2;
     w*=5;               // w=w*5;
     w/=x;               // w=w/x;
     w%=6;               // w=w%6;

     ++x;                // x=x+1
     w++;                // w=w+1
     --y;                // y=y-1
          
}