//////////////////////////////////////////////////////////
//
// complex.h - Header file of complex number class
//
//////////////////////////////////////////////////////////

#ifndef COMPLEX_H_
#define COMPLEX_H_

#include <iostream.h>

class Complex
{	float real;
	float imag;
   public:
	Complex(float r = 0, float i = 0)	//default, 1, & 2 arg constructor!
	{	real = r;
		imag = i;
	}								//note the absence of ;s on inline code!
	~Complex() {}
	void add(const Complex& c);		//member functions.
	void sub(const Complex& c);
	const double abs() const;
	// overloaded operators for iostream ops.
	friend istream& operator>>(istream& is, Complex& c);
	friend ostream& operator<<(ostream& os, const Complex& c);
	// overloaded operators for arithmetic ops.
	friend const Complex operator+(const Complex& left, const Complex& right);
	friend const Complex operator-(const Complex& left, const Complex& right);
	friend const Complex operator*(const Complex& left, const Complex& right);
	friend const Complex operator/(const Complex& left, const Complex& right);
	// overloaded operators for logical ops.
	friend const bool operator==(const Complex& left, const Complex& right);
	friend const bool operator!=(const Complex& left, const Complex& right);
	friend const bool operator<=(const Complex& left, const Complex& right);
	friend const bool operator>=(const Complex& left, const Complex& right);
	friend const bool operator<(const Complex& left, const Complex& right);
	friend const bool operator>(const Complex& left, const Complex& right);
	// overloaded assignment operators
	friend const Complex& operator+=(Complex& left, const Complex& right);
	friend const Complex& operator-=(Complex& left, const Complex& right);
	friend const Complex& operator*=(Complex& left, const Complex& right);
	friend const Complex& operator/=(Complex& left, const Complex& right);
};

#endif // COMPLEX_H_
