#ifndef COMPLEX_H #define COMPLEX_H #include using namespace std; class Complex { // avoid friendship friend ostream &operator<< (ostream& os, Complex &c); public: Complex(double n1=0.0, double n2=0.0){ r=n1; i=n2; } void setI(double n){i=n;} void setR(double n){r=n;} double getI()const{return i;} double getR()const{return r;} void print()const; void add(Complex &n); bool isEqualTo(Complex &n)const; // overloaded ops void operator+=(Complex &); const Complex operator+(Complex &); bool operator==(Complex &)const; private: double r; double i; }; #endif