Code /* Complex.h CIS 250 David Klick 2009-02-23 Header file for class (Complex) that handles complex numbers. Please note that comparing complex numbers for ordering does not make much sense, so <, <=, >, >= are just made-up so we can demonstrate how those operators can be overloaded. */ #ifndef __COMPLEX_H__ #define __COMPLEX_H_ #include using std::istream; using std::ostream; using std::cout; using std::endl; class Complex { private: double real; double imag; private: void init(const double, const double); public: Complex(); Complex(const double, const double); double getReal() const; double getComplex() const; Complex operator+(const Complex&) const; Complex operator-(const Complex&) const; Complex operator*(const Complex&) const; Complex operator/(const Complex&) const; bool operator==(const Complex&) const; bool operator!=(const Complex&) const; bool operator>(const Complex&) const; bool operator<(const Complex&) const; bool operator<=(const Complex&) const; bool operator>=(const Complex&) const; Complex operator++(); Complex operator++(int); Complex operator--(); Complex operator--(int); friend ostream& operator<<(ostream&, const Complex&); friend istream& operator>>(istream&, Complex&); }; #endif