Pages

Monday, July 08, 2013

Write a program of Demonstrate Prefix (unary) Increment in C++



Source Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
   #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     : 5
new value of a : 5

No comments:

Post a Comment