{
Public:
Complex ();
Multiple (double);
Complex (double, double);
void write()const;
Compound operator+(const complex &; )const
Complex Operator-(Constant Complex & amp)const
Compound operator * (constant compound & amp)const)
Complex operator/(constant complex & amp)const)
Private:
Double reality;
Double imag
};
Complex:: Complex ()
{
real = imag = 0.0
}
Complex:: complex (double loop)
{
real = re
imag = 0.0
}
Complex:: complex (double re, double im)
{
real = re
imag = im
}
Void complex:: write () constant
{
cout & lt& ltreal & lt& lt"+" & lt; & ltimag & lt& lt me';
}
Operator+(const complex &; U) constant
{
Complex number v(real+u.real, imag+u.imag);
Return to v;
}
Operator-(const complex &; U) constant
{
Complex number v(real-u.real, imag-u.imag);
Return to v;
}
Complex complex:: operator * (constant complex & ampu) constant
{
Complex number v(real*u.real-imag*u.imag, imag * u.real+real * u.imag);
Return to v;
}
Operator/(const complex &; U) constant
{
double ABS _ sq = u . real * u . real+u . imag * u . imag;
Complex number v ((real * u.real+imag * u.imag)/ABS _ sq, (imag * u.real-real * u.imag)/ABS _ sq);
Return to v;
}
Add, subtract, multiply and divide! Landlord quickly adopt it!
Class complex
{
Public:
Complex ();
Multiple (double);
Complex (double, double);
void write()const;
Compound operator+(const complex &; )const
~Complex(){}
Private:
Double reality;
Double imag
};
Complex:: Complex ()
{
real = imag = 0.0
}
Complex:: complex (double loop)
{
real = re
imag = 0.0
}
Complex:: complex (double re, double im)
{
real = re
imag = im
}
Void complex:: write () constant
{
cout & lt& ltreal & lt& lt"+" & lt; & ltimag & lt& lt me';
}
Operator+(const complex &; U) constant
{
Complex number v(real+u.real, imag+u.imag);
Return to v;
}
Only additives