C++ examples for Operator:Increment and decrement operators
Shows use of auto-increment and auto-decrement operators.
#include <iostream> using namespace std; int main() {/*from w ww . j a v a2 s . co m*/ int i = 0; int j = 0; cout << ++i << endl; // Pre-increment cout << j++ << endl; // Post-increment cout << --i << endl; // Pre-decrement cout << j-- << endl; // Post decrement }