CyberSlug Rules!

Beginner Programming CMPS060

Prof. Paulo Franca

Home

Syllabus

Login

Objects

Download

Staff only

increment/decrement:

you could increment a variable by doing this:

x = x +1;

C++ has a special operator for incrementing/decrementing integer variables:

<integer variable name>++ //... will use the variable and then increment
++<integer variable name> // will increment and then use it.

Examples:

int num=1, j=3, k;
k= num++ - j ;
k = --j + 1;
k= j+ ++num;