参考一下代码
using namespace std;
class CComplex
{
double real,image;
public:
CComplex()
{
real=0;image=0;
}
CComplex(double re,double im)
{
real=re;image=im;
}
CComplex operator=(CComplex &temp)
{
real=temp.real;
image=temp.image;
return temp;
}
void Display()
{
if(image>0)cout<
};
void main()
{
CComplex c1(10,20),c2;
c2=c1;
c1.Display();
c2.Display();
}