Monday, December 17, 2012

EXAMPLE CODING OF INCREMENT AND DECREMENT OPERATORS IN C++


#include<iostream.h>
void main()
{
int num, a,b,c,d;
cout<<"ENTER A NUMBER : ";
cin>>num;
a=num;
b=num;
c=num;
d=num;
cout<<"\n"<<num<<" is assigned to a,b,c and d : "<<endl;
cout<<"++a = " << ++a<<"\n--b = "<< --b<<"\nc++ = " << c++<<endl;
cout<<"d-- = " << d--<<endl;
cout<<"a = "<<a<<"\nb = "<<b<<"\nc = "<<c<<"\nd = "<<d<<endl;
}

No comments: