mọi người giúp với ạ.mình không biết sai chỗ nào mà chạy k ra được cái module.
link đây ạ.
using namespace std;
#include<iostream>
#include<math.h>
class sophuc
{
private:
int a,b;
public:
sophuc()
{
a=b=0;
}
sophuc(int x,int y)
{
a=x;
b=y;
}
friend istream& operator >>(istream& is,sophuc &p )
{
cout<<"nhap a:";
is>>p.a;
cout<<"nhap b:";
is>>p.b;
return is;
}
friend ostream& operator <<(ostream& os,sophuc p)
{
os<<"so phuc la:"<<p.a<<"+"<<p.b<<"i"<<endl;
return os;
}
sophuc module(sophuc x)
{
float z;
z=sqrt(x.a*x.a+x.b*x.b);
return x;
}
~sophuc()
{
}
};
main()
{
sophuc p1,p2,c,d,x;
cin>>p1;
cout<<"\nso phuc 1:"<<p1;
cout<<"\nmodule la:"<<p1.module();
cin>>p2;
cout<<"\nso phuc 2:"<<p2;
cout<<"\nmodule la:"<<p2.module();
return 0;
};