// Complex class header file

#ifndef complex_h

#undef AFX_API
#define AFX_API AFX_EXT_CLASS
#define complex_h

#include <iostream.h>

class CComplex
{
	// overloaded operators
	friend ostream& operator <<(ostream&, CComplex&);
	friend CComplex operator *(CComplex&, CComplex&);
	friend CComplex operator *(CComplex&, double);
	friend CComplex operator +(CComplex&, CComplex&);
	friend CComplex operator +=(CComplex&, CComplex&);
	friend CComplex operator -=(CComplex&, CComplex&);
	friend CComplex operator /=(CComplex&, double);
	friend bool operator ==(CComplex&, CComplex&);

private: 

	double real, imag;		// complex components 

public:

	// constructors
	CComplex(void);				// initialised to zero
	CComplex(double);			// initialise real part only
	CComplex(double, double);	// initialise real and imaginary parts

	// destructor
	~CComplex();		// nothing called awithin destructor
						// as no dynamic memoery allocation made

	// accessor functions
	double imagpart(void);
	double realpart(void);
	
	// set function
	void set(double, double);

	// complex magnitude functions
	double mag(void);
	double magsqrd(void);
};

#endif