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

📄 comflash.h

📁 大数运算库
💻 H
字号:
/*
 * Quick and dirty complex data type using flash arithmetic
 * Should be extended
 */


#ifndef COMFLASH_H
#define COMFLASH_H

#include <flash.h>

class Complex
{
    Flash x,y;
public:
    Complex() {x=(Flash)0; y=(Flash)0; }
    Complex(int a) {x=(Flash)a; y=(Flash)0; }
    Complex(const Flash& a) {x=a; y=(Flash)0; }
    Complex(const Flash& a,const Flash& b) {x=a;y=b;}
    Complex(const Complex& a) {x=a.x;y=a.y;}

    Complex& operator=(const Complex &);
    Complex& operator+=(const Complex &);
    Complex& operator-=(const Complex &);
    Complex& operator*=(const Complex &);
    Complex& operator/=(const Complex &);

    BOOL iszero() const;

    friend Flash real(const Complex &);
    friend Flash imaginary(const Complex &);
    friend Complex recip(const Complex &);

    friend Complex operator-(const Complex&);

    friend BOOL operator==(const Complex&,const Complex&);
    friend BOOL operator!=(const Complex&,const Complex&);

    friend Complex operator+(const Complex &, const Complex &);
    friend Complex operator-(const Complex &, const Complex &);
    friend Complex operator*(const Complex &, const Complex &);
    friend Complex operator/(const Complex &, const Complex &);
    friend Complex exp(const Complex &);
    friend Complex pow(const Complex &,int);
    friend ostream& operator<<(ostream&,const Complex&);
    ~Complex() {}
};

#endif

⌨️ 快捷键说明

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