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

📄 complex.hpp

📁 复数类
💻 HPP
字号:
#pragma once
#include <iostream>

class Complex
{
private:
	double real;
	double imag;

public:
	template< typename Type >
	Complex( Type const&, Type const& );

	template< typename Type >
    Complex( Type const& );

	Complex();

	double GetReal() const;
	double GetImag() const;

	void   SetReal( double );
	void   SetImag( double );

	friend
	std::ostream& operator << ( std::ostream&,  Complex const& );
	
	template< typename Type >
	friend Complex operator+( Type const&, Complex const& );
    template< typename Type >
	friend Complex operator-( Type const&, Complex const& );
	template< typename Type >
	friend Complex operator*( Type const&, Complex const& );
	template< typename Type >
	friend Complex operator/( Type const&, Complex const& );

	template< typename Type >
	friend Complex operator+( Complex const&, Type const& );
    template< typename Type >
	friend Complex operator-( Complex const&, Type const& );
	template< typename Type >
	friend Complex operator*( Complex const&, Type const& );
	template< typename Type >
	friend Complex operator/( Complex const&, Type const& );

	friend
    Complex operator+ ( Complex const&, Complex const& );
	friend
    Complex operator- ( Complex const&, Complex const& );
	friend
    Complex operator* ( Complex const&, Complex const& );
	friend
    Complex operator/ ( Complex const&, Complex const& );
};





⌨️ 快捷键说明

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