#include<bits/stdc++.h>
using namespace std;
struct bigint{
int lll[255],len;
bigint operator +(const bigint&a){
bigint b;
for(int i=0;i<=255;i++){
b.lll[i]=lll[i]+a.lll[i];
}
//加法
for(int i=0;i<=255;i++){
if(b.lll[i]>9){
b.lll[i]%=10;
b.lll[i+1]++;
}
}
//统计
return b;
}
//加法
bigint operator -(const bigint&a){
bigint b;
for(int i=0;i<=255;i++){
b.lll[i]=lll[i]-a.lll[i];
}
//减法
for(int i=0;i<=255;i++){
if(b.lll[i]<0){
b.lll[i]=(b.lll[i]+10)%10;
b.lll[i+1]--;
}
}
//统计
return b;
}
//减法
};
istream & operator>>(istream &in, bigint &A){
string s;
in>>s;
memset(A.lll,0,sizeof(A.lll));
A.len=s.size();
for(int i=0,j=A.len;i<A.len;i++,j--){
A.lll[j]=s[i]-'0';
}
return in;
}
ostream & operator<<(ostream &out, const bigint &A){
bool flag=0;
for(int i=A.len;i>0;i--){
if(A.lll[i]==0&&flag==0){
continue;
}
if(A.lll[i]!=0){
flag=1;
out<<A.lll[i];
}
}
return out;
}
引用方法:bigint 标识符
如bigint a;