Multiplication of complex numbers

I am trying trying to write a class that can multiply complex numbers but without overloading operators
Any help would be much appreciated

Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class complex
{
private:
    double Re, Im;
/*...*/
public:
    void multiply(complex that);
/*...*/
};

void complex::multiply(complex that)
{
    Re = Re * that.Re - Im * that.Im;
    Im = Im * that.re + Re * that.Im;
}
/* usage */
complex x(1, 2), y(3, 4);
x.multiply(y);
Topic archived. No new replies allowed.