
#include<iostream.h>
#include<stdlib.h>


class comp{
  private:
	float a,b;
  public:


void prncomp()
{	cout<<"\n A="<<a<<"  B="<<b<<" \n";}
void getcomp()
{	cout<<" INPUT A  B (A+iB) \n";cin>>a>>b;}
//------------
	comp()
{	a=0;b=0;}

	comp (float x,float y)
{	a=x;b=y;}
//---constr2

comp operator+(comp &x)
{
	comp r(0,0);
	r.a=a+x.a;
	r.b=b+x.b;
	return r;
}
//--------- +
comp operator=(comp &x)
{    a=x.a;b=x.b;return *this;}
//-------- =
comp operator-(comp &x)
{	comp r;
	r.a=a-x.a;r.b=b-x.b;
	return r;
}
//---- -
comp operator*(comp &x)
{	comp r;
	r.a=a*x.a-b*x.b;r.b=a*x.b+b*x.a;
	return r;
}
//----- *
comp operator/(comp &x)
{	comp r;
	r.a=(a*x.a+b*x.b)/(a*a+b*b);
	r.b=(b*x.a-a*x.b)/(a*a+b*b);
	return r;
}
//---- /
comp operator+(float z)
{	comp r;r.a=a+z;r.b=b;return r;}
comp operator-(float z)
{	comp r;r.a=a-z;r.b=b;return r;}
comp operator*(float z)
{	comp r;r.a=z*a;r.b=z*b;return r;}
comp operator/(float z)
{	comp r;r.a=a/z;r.b=b/z;return r;}



ostream& operator<<(ostream& x,comp y)
{
	x<<"A="<<y.a<<"  B="<<y.b;return x;
}
istream& operator>>(istream& x,comp &y)
{
	x>>y.a>>y.b;
	return x;}

};

int main()
{
	comp x,y(5,10),z(3,5),y1(5,15);

	x=y+z;
	x.prncomp();
	x=y*z;x.prncomp();
	x=y-z;x.prncomp();
	x=y/z;x.prncomp();

	y1=y1+5.3;y1.prncomp();
	y1=y1-7.3;y1.prncomp();
	y1=y1*2;y1.prncomp();
	y1=y1/2;y1.prncomp();

	cout<<x<<'  '<<y1;
	return 1;

}
