#include<iostream>
using namespace std;
class complex{
double real;
double image;
public:
complex(double r=0,double i=0):real(r),image(i){};
complex(const complex& c): real(c.real),image(c.image){};
~complex(){};
double re() const{
return real;
}
double im() const{
return image;
};
const complex&operator=(const complex&c)
{
real=c.real;
image=c.image;
return *this;
};
const complex&operator+=(const complex&c)
{
real+=c.real;
image+=c.image;
return *this;
};
const complex&operator-=(const complex&c)
{
real-=c.real;
image-=c.image;
return *this;
};
const complex&operator*=(const complex&c)
{
double keepreal=real;
real=real*c.real-image*c.image;
image=keepreal*c.image+image*c.real;
return *this;
};
const complex&operator/=(double d)
{
real/=d;
image/=d;
return *this;
};
friend complex operator!(const complex &c)
{
return complex(c.re(),-c.im());
};
friend double abs2(const complex&c)
{
return (c.re()*c.re()+c.im()*c.im());
};
const complex&operator/=(const complex&c)
{
return *this *=(!c)/=abs2(c);
};
const complex operator+(const complex& c, const complex& d)
{
return complex(c.re()+d.re(),c.im()+d.im());
};
const complex operator-(const complex& c, const complex& d)
{
return complex(c.re()-d.re(),c.im()-d.im());
};
const complex operator-(const complex&c)
{
return complex(-c.re(),-c.im());
};
const complex operator/(const complex&c,const complex&d)
{
return complex(c)/=d;
};
};
int main(){
complex c=1.,d(3.,4.);
return 0;
}