#ifndef COMPLEX_HPP
#define COMPLEX_HPP

#include <math.h>

class Complex {
    double re, im;
public:
    Complex(double a_re = 0, double a_im = 0) : re(a_re), im(a_im) {}

    double GetRe() const { return re; }
    double GetIm() const { return im; }

    double Magnitude() const { return sqrt(re*re + im*im); }
    double Argument() const { return atan2(im, re); }

    const Complex& operator=(const Complex &c)
        { re = c.re; im = c.im; return *this; }

    const Complex &operator+=(const Complex &c)
        { re += c.re; im += c.im; return *this; }
    const Complex &operator-=(const Complex &c)
        { re -= c.re; im -= c.re; return *this; }
    const Complex &operator*=(const Complex &c);
    const Complex &operator/=(const Complex &c);

    void Print() const;
};

inline Complex operator+(Complex a, const Complex& b) { return a += b; }
inline Complex operator-(Complex a, const Complex& b) { return a -= b; }
inline Complex operator*(Complex a, const Complex& b) { return a *= b; }
inline Complex operator/(Complex a, const Complex& b) { return a /= b; }

#endif
