Wow thank you guys for going through all that trouble. In my Complex class, it all works similarly. It is only my Matrix class that's giving me trouble. In case you want to compare the ostream operator for the Complex class to the Matrix one, here it is:
Code:ostream& operator <<(ostream &out, Complex &a) { if(a.real != 0) out<<a.real; if(a.imag < 0 && a.real != 0) out<<"-j"<<-a.imag; if(a.imag > 0 && a.real != 0) out<<"+j"<<a.imag; if(a.real == 0 && a.imag == 0) out<<"0"; if(a.imag < 0 && a.real == 0) out<<"-j"<<-a.imag; if(a.imag > 0 && a.real == 0) out<<"+j"<<a.imag; return out; }



LinkBack URL
About LinkBacks


