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 decrement -- for an integer number.

Saturday, February 28, 2015

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

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


#include<conio.h>
#include<iostream.h>
class decrement
{
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 decrement is:-"<<no;
       }
};
int main()
{
decrement i;
clrscr();
i.getdata();
--i;
i.display();
getch();
return 0;
}








==================================================
OUTPUT

Enter the number:-6

The number after decrement is:-5

श्री राम मंत्र

  श्री राम मंत्र यहाँ श्री राम मंत्र के कुछ प्रमुख मंत्र हैं: 1. ॐ श्री रामाय नमः - यह मंत्र भगवान राम की आराधना और उनकी कृपा प्राप्त करने क...