问题
填空题
有如下复数类的声明,请补充完整。
class complex
double real; //实部
double imag; //虚部
public:
complex(double x,double y)
real=x;
imag=y;
complex operator+(complex c) //重载加法运算符“+”
return complex(______);
;
答案
参考答案:real+c.real,imag+c.imag或 this->real+c.real,this->imag+c.imag