#include<iostream.h>
#include<conio.h>
class Min
{
public:
int x;
int y;
int z;
void getdata();
void show();
friend Min operator -- (Min v);
};
void Min :: getdata()
{
cout<<"Enter the value of x,y and z"<<endl;
cin>>x>>y>>z;
}
void Min :: show()
{
cout<<x<<endl<<y<<endl<<z<<endl;
}
Min operator -- (Min v)
{
v.x=--v.x;
v.y=--v.y;
v.z=--v.z;
return Min(v);
}
void main()
{
Min v1,v2;
clrscr();
v1.getdata();
cout<<"Before decremented: "<<endl;
v1.show();
v2= --v1;
cout<<"After decremented: "<<endl;
v2.show();
getch();
}
#include<conio.h>
class Min
{
public:
int x;
int y;
int z;
void getdata();
void show();
friend Min operator -- (Min v);
};
void Min :: getdata()
{
cout<<"Enter the value of x,y and z"<<endl;
cin>>x>>y>>z;
}
void Min :: show()
{
cout<<x<<endl<<y<<endl<<z<<endl;
}
Min operator -- (Min v)
{
v.x=--v.x;
v.y=--v.y;
v.z=--v.z;
return Min(v);
}
void main()
{
Min v1,v2;
clrscr();
v1.getdata();
cout<<"Before decremented: "<<endl;
v1.show();
v2= --v1;
cout<<"After decremented: "<<endl;
v2.show();
getch();
}
OUTPUT
No comments:
Post a Comment