>>
. 现在他们想像这样重载它,首先我们输入实数,然后输入虚数,然后输入算符,再输入复数,当我们输入时停止输入
=
查尔,我在这里很困惑,我需要你的帮助,我该怎么做?
这是我的方程式课
class Equation{
private:
ComplexNumber *cns;
char *operatori;
int len=0;
public:
Equation(ComplexNumber *cns=0,char *operatori=0)
{
this->len=len;
this->cns = new ComplexNumber[len];
for (int i=0;i
{
this->cns[i]=cns[i];
}
this->operatori = new char [strlen(operatori)+1];
strcpy(this->operatori,operatori);
}
Equation (const Equation &e)
{
this->len=e.len;
this->cns = new ComplexNumber[e.len];
for (int i=0;i
{
this->cns[i]=e.cns[i];
}
this->operatori = new char [strlen(e.operatori)+1];
strcpy(this->operatori,e.operatori);
}
Equation &operator =( Equation &e)
{
if (this != &e)
{
delete [] cns;
delete [] operatori;
this->len=e.len;
this->cns = new ComplexNumber[e.len];
for (int i=0;i
{
this->cns[i]=e.cns[i];
}
this->operatori = new char [strlen(e.operatori)+1];
strcpy(this->operatori,e.operatori);
}
return *this;
}