#include<iostream>
using namespace std;
class complex
{
double real;
double imag;
public:
complex operator-=(int n)
{
real-=n;
imag-=n;
complex temp;
temp.real=real;
temp.imag=imag;
return temp;
}
void display()
{
cout<<“(“<<real<<“,”<<imag<<“)”<<endl;
}
void set()
{
cout<<“Enter real: “<<endl;
cin>>real;
cout<<“Enter imag: “<<endl;
cin>>imag;
}
};
int main()
{
complex c1;
c1.set();
cout<<“complex no:”<<endl;
c1.display();
cout<<“After the decrement of 10: “<<endl;
c1-=10;
c1.display();
system(” pause”);
}
<——–End——>
Output will be:
Enter Real:
15
Enter Imag:
45
complex no:
(15 , 45)
After the decrement of 10:
(5 , 35)
<—–End—–>