Demonstrates the increment operator - C++ Operator

C++ examples for Operator:Increment and decrement operators

Description

Demonstrates the increment operator

Demo Code

#include <iostream>
using namespace std;
int main()//from ww  w .j  av a2  s.  c  o  m
{
   int count = 10;
   cout << "count=" << count << endl;    //displays 10
   cout << "count=" << ++count << endl;  //displays 11 (prefix)
   cout << "count=" << count << endl;    //displays 11
   cout << "count=" << count++ << endl;  //displays 11 (postfix)
   cout << "count=" << count << endl;    //displays 12
   return 0;
}

Result


Related Tutorials