Pages

Saturday, July 06, 2013

Write a program of Demonstrate Postfix Increment in C++

Demonstrate Postfix Increment

Source Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
   #include <iostream.h>
   #include <conio.h>
   #include <iomanip.h>
   int main ()
   {
      int a = 4;
    cout << "value of a     : " << setw(2) << a   << endl;   
    cout << "value of a++   : " << setw(2) << a++ << endl;   
    cout << "new value of a : " << setw(2) << a   << endl;   
       
       
   getch ();
   return 0;    
              }// main

Output:

value of a     : 4
value of a     : 4
new value of a : 5

No comments:

Post a Comment