00001 #ifndef COMPLEX_H 00002 #define COMPLEX_H 00003 00004 #include <math.h> 00005 00010 class Complex 00011 { 00012 float _re; 00013 float _im; 00014 00015 public: 00016 Complex(const float re = 0.0, const float im = 0.0); 00017 00018 inline float real() const { return _re; } 00019 inline float imag() const { return _im; } 00020 00021 void setReal(float re) { _re = re;} 00022 void setImag(float im) { _im = im;} 00023 00024 bool operator==(const Complex&) const; 00025 00026 Complex& operator+=(const Complex&); 00027 Complex& operator-=(const Complex&); 00028 Complex& operator*=(const Complex&); 00029 Complex& operator/=(const Complex&); 00030 00031 Complex operator+(const Complex&) const; 00032 Complex operator-(const Complex&) const; 00033 Complex operator*(const Complex&) const; 00034 Complex operator/(const Complex&) const; 00035 00036 float abs(); 00037 }; 00038 00039 Complex operator+(const double, const Complex&); 00040 Complex operator-(const double, const Complex&); 00041 Complex operator*(const double, const Complex&); 00042 Complex operator/(const double, const Complex&); 00043 00044 #endif // COMPLEX_H