#include<iostream.h>
#include<math.h>
class complex
{
private:
double real;
double imag;
public:
complex()
{
real=0.0;imag=0.0;
}
complex(double r=0.0,double i=0.0)
{real=r;imag=i;}
~complex()
{
cout<<"destructing..."<<endl;
}
double realcomplex() {return real;}
double imagcomplex() {return imag;}
double abscomplex()
{
double t;
t=real*real+imag*imag;
return sqrt(t);
}
};
int main()
{
complex a(1.1,2.2);
cout<<"real of complex a="<<a.realcomplex()<<endl;
cout<<"image of complex a="<<a.imagcomplex()<<endl;
cout<<"abs of complex a="<<a.abscomplex()<<endl;
complex b;
cout<<"real of complex b="<<b.realcomplex()<<endl;
cout<<"image of complex b="<<b.imagcomplex()<<endl;
cout<<"abs of complex b="<<b.abscomplex()<<endl;
complex c(1.0);
cout<<"real of complex c="<<c.realcomplex()<<endl;
cout<<"image of complex c="<<c.imagcomplex()<<endl;
cout<<"abs of complex c="<<c.abscomplex()<<endl;
return 0;
}