Please send questions to st10@humboldt.edu .

CIS 130 - Lecture 14 - 11-30-05
REALLY random projected notes...
--------------------------------

increment operator: ++
decrement operator: --

really....
 prefix increment operator
 postfix increment operator
 prefix decrement operator
 postfix decrement operator

int i = 3;

++i;    // prefix increment operator
i++;    // postfix increment operator

* POINT ONE: ++ always increases the value of the variable it is
  applied to by one --- that is its side-effect.

* POINT TWO: an expression using ++ is, well, an expression.
  It has a value.
  For prefix ++, the value is the value of the variable AFTER it is increased.

  For postfix ++, the value is the value of the variable BEFORE it is 
  increased.
------------
int val;
int amt;

val = 27;
amt = ++val;
-----------
// after the above, val is 28, amt is 28

------------
val = 56;
amt = val++;
------------
// after the above, val is 57, but amt is 56!!!!!

the operators += *= -= /=: are the same as...

amt = amt + 48;
amt += 48;

amt *= 126;
amt = amt * 126;

quant -= 33;
quant = quant - 33;

george /= 5;
george = george / 5;

quant = (++c) - (++c)++;


switch statement:

*   another branching statement!
*   C++'s "case" statement


switch(int_expr)
{
    case val1:
    case val8:
    case val27:
        sttm1;
        sttmt2;

    case val2:
        sttmt1;
        sttmt2;
        break;

    ...
    default:
        sttmt1;
        sttmt2;
}
// after switch