#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>

using namespace std;

class Complex

{

public:

void display( )

{

/*cout << "real:" << this->_real << endl;

cout << "p_w_picpath:" << this->_p_w_picpath << endl;*/

cout << this->_real << "+" << this->_p_w_picpath << "i" << endl;

}

Complex operator+(const Complex& a)

{

Complex tem;

tem._real = this->_real + a._real;

tem._p_w_picpath = this->_p_w_picpath + a._p_w_picpath;

return tem;

}

Complex operator-(const Complex& a)

{

Complex tem;

tem._real = this->_real - a._real;

tem._p_w_picpath = this->_p_w_picpath - a._p_w_picpath;

return tem;

}

Complex operator*(const Complex& a)

{

Complex tem;

tem._real = this->_real * a._real;

tem._p_w_picpath = this->_p_w_picpath * a._p_w_picpath;

return tem;

}

Complex operator/(const Complex& a)

{

Complex tem;

tem._real = this->_real / a._real;

tem._p_w_picpath = this->_p_w_picpath / a._p_w_picpath;

return tem;

}

void operator+=(const Complex& a)

{

this->_real = this->_real + a._real;

this->_p_w_picpath = this->_p_w_picpath + a._p_w_picpath;

}

void operator-=(const Complex& a)

{

this->_real = this->_real - a._real;

this->_p_w_picpath = this->_p_w_picpath - a._p_w_picpath;

}

void operator*=(const Complex& a)

{

this->_real = this->_real * a._real;

this->_p_w_picpath = this->_p_w_picpath * a._p_w_picpath;

}

void operator/=(const Complex& a)

{

this->_real = this->_real / a._real;

this->_p_w_picpath = this->_p_w_picpath / a._p_w_picpath;

}

Complex operator++(int)//huozhi

{

Complex tem(*this);

this->_real += 1;

this->_p_w_picpath += 1;

return tem;

}

Complex& operator++()

{

this->_real += 1;

this->_p_w_picpath += 1;

return *this;

}

Complex operator--(int)//huozhi

{

Complex tem(*this);

this->_real -= 1;

this->_p_w_picpath -= 1;

return tem;

}

Complex& operator--()

{

this->_real -= 1;

this->_p_w_picpath -= 1;

return *this;

}

bool operator>(const Complex& a)

{

double m = pow(this->_real, 2) + pow(this->_p_w_picpath, 2);

double n = pow(a._real, 2) + pow(a._p_w_picpath, 2);

return (m > n);

}

bool operator<(const Complex& a)

{

double m = pow(this->_real, 2) + pow(this->_p_w_picpath, 2);

double n = pow(a._real, 2) + pow(a._p_w_picpath, 2);

return (m < n);

}

bool operator>=(const Complex& a)

{

double m = pow(this->_real, 2) + pow(this->_p_w_picpath, 2);

double n = pow(a._real, 2) + pow(a._p_w_picpath, 2);

return (m > n || m == n);

}

bool operator<=(const Complex& a)

{

double m = pow(this->_real, 2) + pow(this->_p_w_picpath, 2);

double n = pow(a._real, 2) + pow(a._p_w_picpath, 2);

return (m < n || m == n);

}

bool operator==(const Complex& a)

{

double m = pow(this->_real, 2) + pow(this->_p_w_picpath, 2);

double n = pow(a._real, 2) + pow(a._p_w_picpath, 2);

return (m == n);

}

public:

Complex(double real = 0.0, double p_w_picpath = 0.0)

{

this->_real = real;

this->_p_w_picpath = p_w_picpath;

}

Complex(Complex& a)

{

this->_real = a._real;

this->_p_w_picpath = a._p_w_picpath;

}

~Complex()

{

;

}

Complex* operator=(const Complex& a)

{

this->_real = a._real;

this->_p_w_picpath = a._p_w_picpath;

return this;

}

private:

double _real;

double _p_w_picpath;

};

int main()

{

Complex first(1.0, 2.0);

first.display();

Complex second(first);

second.display();

Complex three;

//three = second = first;

//second.display();

//three = first + second;

first.operator++(1);

first.display();

system("pause");

return 0;

}