Test arithmetic assignment and decrement - C++ Operator

C++ examples for Operator:Arithmetic Operator

Description

Test arithmetic assignment and decrement

Demo Code

#include <iostream>
using namespace std;
int main()//from  ww w.  j a  v  a 2 s . c  o m
{
   int var = 10;
   cout << var << endl;      // var is 10
   var *= 2;                 // var becomes 20
   cout << var-- << endl;    // displays var, then decrements it
   cout << var << endl;      // var is 19
   return 0;
}

Result


Related Tutorials