Wednesday, 1 February 2012

Program Of Increment & Decrement Operators


#include<iostream.h>
#include<conio.h>
main()
{
clrscr();
int a,b,c,d,e,f,g,h;
a=10;
b=++a;     // b = 11 & a= 11
c=a--;     // c = 11 & a=10
d=--a;    // d = 9 & a= 9
e=++a;    // e= 10 a=10
f=--a;    // f= 9 a= 9
g=a--;    // g =9 a=8
h=--a;    // h = 7 a = 7
cout<<"\n a="<<a;
cout<<"\n b="<<b;
cout<<"\n c="<<c;
cout<<"\n d="<<d;
cout<<"\n e="<<e;
cout<<"\n f="<<f;
cout<<"\n g="<<g;
cout<<"\n h="<<h;
getch();
}

No comments:

Post a Comment