complex.hpp
来自「复数类」· HPP 代码 · 共 60 行
HPP
60 行
#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 + =
减小字号Ctrl + -
显示快捷键?