⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 complex.h

📁 dot NET 下的大整数乘法
💻 H
字号:
#pragma once

using namespace System;

value class CComplex
{
public:
	property double Re
	{
		double get()
		{
			return m_re;
		}
		void set(double value)
		{
			m_re=value;
		}
	}

	property double Im
	{
		double get()
		{
			return m_im;
		}
		void set(double value)
		{
			m_im=value;
		}
	}

	static CComplex FromReal(double re)
	{
		CComplex temp;
		temp.m_re=re;
		temp.m_im=0;
		return temp;
	}
	static CComplex FromAnother(const CComplex% rhs)
	{
		CComplex temp;
		temp.m_re=rhs.m_re;
		temp.m_im=rhs.m_im;
		return temp;
	}
	static CComplex FromReIm(double re, double im)
	{
		CComplex temp;
		temp.m_re=re;
		temp.m_im=im;
		return temp;
	}
	static double Power(const CComplex% rhs)
	{
		return (rhs.m_re*rhs.m_re+rhs.m_im*rhs.m_im);
	}
	static double Abs(const CComplex% rhs)
	{
		return (Math::Sqrt(Power(rhs)));
	}
	static double Arg(const CComplex% rhs)
	{
		return (Math::Atan2(rhs.m_im, rhs.m_re));
	}
	bool operator == (const CComplex% rhs)
	{
		if ((Math::Abs(m_re-rhs.m_re)<1e-10)
		  &&(Math::Abs(m_im-rhs.m_im)<1e-10))
		{
			return true;
		}
		return false;
	}

	bool operator != (const CComplex% rhs)
	{
		return !((*this)==rhs);
	}

	CComplex operator + (const CComplex% rhs)
	{
		CComplex temp;
		temp.m_re=m_re+rhs.m_re;
		temp.m_im=m_im+rhs.m_im;
		return temp;
	}

	CComplex operator - (const CComplex% rhs)
	{
		CComplex temp;
		temp.m_re=m_re-rhs.m_re;
		temp.m_im=m_im-rhs.m_im;
		return temp;
	}

	CComplex operator * (const CComplex% rhs)
	{
		CComplex temp;
		temp.m_re=m_re*rhs.m_re-m_im*rhs.m_im;
		temp.m_im=m_re*rhs.m_im+m_im*rhs.m_re;
		return temp;
	}

private:
	double m_re;
	double m_im;
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -