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

📄 chugeinteger.h

📁 利用Linklist实现超大整数之加减乘除
💻 H
字号:
#include <string>

using namespace std;

#ifndef _H_CHugeInteger_
#define _H_CHugeInteger_

typedef unsigned char BYTE;
typedef unsigned int  UINT;

typedef  struct  NODE
{
	BYTE	data;
	struct	NODE* p;
	struct	NODE* n;
}NODE,*NODEH;

typedef struct LIST
{
    NODEH head;   
    NODEH end;   
    int   length;
}LIST,*LISTH;

class HugeInteger
{
public:
	HugeInteger();
	~HugeInteger();

	void input(string A,string B);
	void output();
	void output(char* A);
	void add();
	void subtract();
	void multiply();
	void divide();
	void modulus();
	bool isEqualTo();
	bool isNotEqualTo();
	bool isGreaterThan();
	bool isLessThan();
	bool isGreaterThanOrEqualTo();
	bool isLessThanOrEqualTo();
	bool isZero(string str_num);

private:
	bool	flag;
	string	a;
	string	b;
	int		sig;
    LISTH	NUM;
};

bool	InitList(LISTH& L);
NODEH	NMalloc(const BYTE& elem);
bool	ADD(const LISTH& La,LISTH& Lb);
bool	SUB(const LISTH& La,LISTH& Lb);
bool	PreAdd(LISTH& L,const BYTE& elem);
bool	EndAdd(LISTH& L,const BYTE& elem);
bool	DestoryList(LISTH& L);
void	PrintList(LISTH& L);
bool	AddZero(LISTH& L,UINT count);
bool	BitMul(const LISTH& L,const UINT number,LISTH& NUM);
bool	CmpHGInt(LISTH& L1,LISTH& L2,UINT Len);
bool	DivCmp(LISTH& L1,LISTH& L2);
void	CopyLIST(LISTH& Src,LISTH& Des,UINT Len);
void	TestDIV(const LISTH& BCS,LISTH& TMPCS,LISTH& NUM,LISTH& TSTPDT);

#endif /* _H_CHugeInteger_ */

⌨️ 快捷键说明

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