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

📄 hugeint.h

📁 此程序用于大整数运算
💻 H
字号:
#ifndef HUGEINT
#define HUGEINT
#include <iostream>
#include <vector>
using std::ostream;
using std::vector;
using std::istream;
typedef vector<short> INT;
class HugeInt;										
HugeInt operator +(const HugeInt&,const HugeInt&);
HugeInt operator -(const HugeInt&,const HugeInt&);
HugeInt operator /(const HugeInt&,const HugeInt&);
HugeInt operator *(const HugeInt&,const HugeInt&);
HugeInt operator %(const HugeInt&,const HugeInt&);
bool operator >(const HugeInt&,const HugeInt&);
bool operator >=(const HugeInt&,const HugeInt&);
bool operator <(const HugeInt&,const HugeInt&);
bool operator <=(const HugeInt&,const HugeInt&);
bool operator ==(const HugeInt&,const HugeInt&);
bool operator !=(const HugeInt&,const HugeInt&);
istream& operator >>(istream&,HugeInt&);
ostream& operator <<(ostream&,HugeInt&);
bool compare(const INT&,const INT&);
INT operator +(const INT&,const INT&);
INT operator -(const INT&,const INT&);
INT operator /(const INT&,const INT&);
INT operator *(const INT&,const INT&);

struct math_error{
	int i;
	math_error(int ii){i=ii;}
	};
class HugeInt{
private:
	bool ch;
	INT value;
public:
	HugeInt();
	HugeInt(HugeInt &);
	HugeInt(long);
	HugeInt(char*);
	~HugeInt();
	HugeInt& operator =(const HugeInt&);

	friend HugeInt operator +(const HugeInt&,const HugeInt&);
	friend HugeInt operator -(const HugeInt&,const HugeInt&);
	friend HugeInt operator *(const HugeInt&,const HugeInt&);
	friend HugeInt operator /(const HugeInt&,const HugeInt&);
	friend HugeInt operator %(const HugeInt&,const HugeInt&);	
	friend bool operator >(const HugeInt&,const HugeInt&);
	friend bool operator >=(const HugeInt&,const HugeInt&);
	friend bool operator <(const HugeInt&,const HugeInt&);
	friend bool operator <=(const HugeInt&,const HugeInt&);
	friend bool operator ==(const HugeInt&,const HugeInt&);
	friend bool operator !=(const HugeInt&,const HugeInt&);
	friend istream& operator >>(istream&,HugeInt&);
	friend ostream& operator <<(ostream&,HugeInt&);
	friend bool compare(const INT&,const INT&);
	friend INT operator +(const INT&,const INT&);
	friend INT operator -(const INT&,const INT&);
	friend INT operator *(const INT&,const INT&);
	friend INT operator /(const INT&,const INT&);
};

#endif

⌨️ 快捷键说明

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