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

📄 verylong.h

📁 大数相乘的源代码,使用C++在VC环境中实现.
💻 H
字号:
//verylong.h
//class specifier for very long integer type
#include<iostream>
#include<string.h>
#include<stdlib.h>
using namespace std;

const long int SZ=100000;			//maximum digits in verylongs 
class verylong 
{
private:
	char vlstr[SZ];			//verylong number,as a string
	int vlen;				//length of verylong string 
	verylong multdigit(const int)const;//prototypes for private functions
	verylong mult10(const verylong)const;
public:
	verylong():vlen(0)		//no-arg constructor
	{
		vlstr[0]='\0';
	}
	verylong(const char s[SZ])				//one-arg constructor for string
	{
		strcpy(vlstr,s);
		vlen=strlen(s);
	}
	verylong(const unsigned long n)			//one-arg constructor for long int
	{
		ltoa(n,vlstr,10);					//convert to string
		strrev(vlstr);		//reverse it
		vlen=strlen(vlstr);	//find length
	}
	void putvl() const;		//display verylong
	void getvl();			//get verylong from user
	verylong operator +(const verylong);	//add verylongs
	verylong operator * (const verylong);	//multiply verylongs
};

⌨️ 快捷键说明

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