C++————复数类:complex c++

#include
using namespace std;
class complex
{
public:
	complex()
	{
	}
	complex(double real,double imag)//构造函数
	{
		_real=real;
		_imag=imag;
	}
	~complex()//析构函数
	{
	}
	void print()
	{
		cout<<"实部:"<<_real<<"虚部:"<<_imag<(complex& c)const
	{
		if(_real>c._real)
			return true;
		else if(_real==c._real)
		{
			if(_imag>c._imag)
			{
				return true;
			}
			else
				return false;
		}
		else 
			return false;
	}
	bool operator<(complex& c)const
	{
		if(_real=(complex& c)const
	{
		if(*thisc)
			return false;
		else
			return true;
	}
	bool operator==(complex& c)const
	{
		if((*this>c)||(*this和operator<
{
	complex c(4,2);
	complex c1(5,2);
	bool x = false;
	c.print();
	c1.print();
	x=c >c1;
	cout<=  operator<=
{
	complex c2(1,1);
	complex c3(0,1);
	complex c4(1,1);
	bool x = 0;
	c2.print();
	c3.print();
	x=c2>=c3;
	cout<=c2;
	cout<=c2;
	cout<

你可能感兴趣的:(编程语言,c++)