google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: Write a c++ program using class to overload the operator unary increment ++ for an integer number.

Saturday, February 28, 2015

Write a c++ program using class to overload the operator unary increment ++ for an integer number.

Write a c++ program using class to overload the operator unary increment ++ for an integer number.


#include<conio.h>
#include<iostream.h>
class increment
{
public:int no;
public:void getdata()
       {
       cout<<"\n Enter the number:-";
       cin>>no;
       }
       void operator ++()
       {
       no=no+1;
       }
       void display()
       {
       cout<<"\n The number after increment is:-"<<no;
       }
};
int main()
{
increment i;
clrscr();
i.getdata();
++i;
i.display();
getch();
return 0;
}


=========================================

OUTPUT
Enter the number:-2

The number after increment is:-3

रामायण

रामायण दशरथ की तीन पत्नियाँ – कौशल्या, सुमित्रा , कैकेयी दशरथ के चार पुत्र – राम,लक्ष्मण,भरत,शत्रुघ्न दशरथ: राम के पिता और कौशल के राजा कौशल...