i would do this for you, but 2 things
1) people on this board wouldnt like me very much
2) i have alot of homework tonight but i can get you a head start
Code:
// some odds and ends
class Complex
{
public://private:
double m_Real;
double m_Img;
public:
Complex(double Real = 1.0, double Img = 1.0);
Complex& operator=(const Complex& A);
//e. Overload the == and != operators for comparisons
//f. Overload the operator (<< ) to display the complex numbers.
};
// make these yourself
Complex operator-(const Complex& A, const Complex& B);
Complex operator/(const Complex& A, const Complex& B);
Complex operator*(const Complex& A, const Complex& B);
// constructor
Complex::Complex(double Real, double Img)
{
m_Real = Real;
m_Img = Img;
}
Complex operator+(const Complex& A, const Complex& B)
{
return Complex(A.m_Real + B.m_Real, A.m_Img + B.m_Img);
}
Complex& Complex::operator=(const Complex& A)
{
m_Real = A.m_Real;
m_Img = A.m_Img;
return *this; // A + B; also can be made another way
}
remember there is many ways to think of how to overload...many many ways!!!!!! this was my ugly fast thinking and i might be wrong...but i did this in 1 min...hehe