/* File: complex.H Copyright glh 4/30/97 */ #ifndef COMPLEXH #define COMPLEXH #include #include typedef enum {cartesion, polar} form; class Complex { private: float real, imag; public: Complex(float p1=0, float p2=0, form rep=cartesion) : real(re), imag(im) {} void AssignReal(float re); void AssignImag(float im); float Real(); float Imag(); float Magnitude(); float Phase(); friend ostream& operator<<(ostream& os, const Complex&); friend Complex operator+(const Complex&, const Complex&); friend Complex operator+=(Complex&, const Complex&); friend Complex operator-(const Complex&, const Complex&); friend Complex operator-=(Complex&, const Complex&); friend Complex operator*(const Complex&, const Complex&); friend Complex operator*=(Complex&, const Complex&); friend Complex operator/(const Complex&, const Complex&); friend Complex operator/=(Complex&, const Complex&); friend Complex operator!(const Complex&); // complex conjugate }; inline void Complex::AssignReal(float re) {real = re;} inline void Complex::AssignImag(float im) {imag = im;} inline float Complex::Real() {return real;} inline float Complex::Imag() {return imag;} #endif