You weren't specific on what these operators should do. IIRC, Complex numbers multiply/compare equal by doing said operation with their real component and imaginary component. For operator==, make a global function like this:
1 2 3 4
booloperator==(const Complax& a, const Complax& b) {
return( a.getReal() == b.getReal() &&
a.getImag() == b.getImag() );
}
For operator*, see if you can figure it on your own ;) but hint: It's going to look a lot like and follow the same principle as your operators - and +.
Btw, your operator-() is doing a + of your operands. Lastly your operators *, -, +, and = should accept a const reference, that way you can pass const objects and temporary objects, and it prevents you from accidently modifying your param.
The operator== needs to be a *global* function, ie, outside the body of the class, such as where line 82 is currently. You'll also need a global operator<<(ostream&, const Complax&) function in order to send out z, w, and v on line 100. It could look something like this:
1 2 3 4 5 6
//Return an ostream& to allow chaining of << operators.
ostream& operator<<(ostream& out, const Complax& c)
{
out << c.getReal() << '+' << c.getImag() << 'i'; //Just my guess on how it should look, feel free to change this if you want it to look different.
return( out ); //This allows the chaining.
}
And don't forget what I said previously about your operator-(), and the const refs! ;)