楼主,类的声明就不写了,我想你已经搞定了,我只贴出方法,这是我前几天刚写的
CComplex::CComplex()
{
RealPart=0.0;
ImaginPart=0.0;
}
CComplex::CComplex(double dblx,double dbly)
{
RealPart=dblx;
ImaginPart=dbly;
}
double CComplex::GetReal()const
{
return RealPart;
}
double CComplex::GetImag()const
{
return ImaginPart;
}
CString CComplex::ToString()const
{
CString str;
if(m_dblx>=0 && m_dbly>=0)
{
str.Format("%lf + %lf i",RealPart,ImaginPart);
}
else if(m_dblx>=0 && m_dbly