complex no usig operator overloading
#include
#include
class complex
{
float r,l;
public:
void setdata()
{
cout <<"Enter complex number"; cin >>r>>l;
}
void show()
{
cout <
}
complex operator +(complex p)
{
complex temp;
temp.r=r+p.r;
temp.l=l+p.l;
return(temp);
}
};
void main()
{
clrs r
complex c1,c2,c3;
c1.setdata();
c2.setdata();
c3=c1+c2;
c3.show();
gecth();
}
#include
#include
class complex
{
float r,l;
public:
void setdata()
{
cout <<"Enter complex number"; cin >>r>>l;
}
void show()
{
cout <
complex operator +(complex p)
{
complex temp;
temp.r=r+p.r;
temp.l=l+p.l;
return(temp);
}
};
void main()
{
clrs r
complex c1,c2,c3;
c1.setdata();
c2.setdata();
c3=c1+c2;
c3.show();
gecth();
}
Comments