The simple assignment operator (=) assigns the right side to left side.
C++ provides shorthand operators that have the capability of performing an operation and an assignment at the same time.
int x=5; x+=3; //It's mean x=x+3 x-=2; //It's mean x=x-2 x*=2; //It's mean x=x*2 x/=3; //It's mean x=x/3
The increment operator is used to increase an integer value by one, and is a commonly used C++ operator.
x++; //It's mean x=x+1
int x=10; x++; cout<<x;
The increment operator has two forms, prefix and postfix.
++x; //prefix x++; //postfix
Prefix: Prefix increments the value, and then proceeds with the expression.
Postfix: Postfix evaluate the expression and then performs the increment.
x=4; y=++x; //x is 4, y is 5
The decrement operator (-) works in much the same way as the increment operator, but instead of increasing the value, it decreases it by one.
--x; //prefix x--; //postfix