高精度模板3.0

高精度模板3.0,支持正整数除除法及取模运算外的所有基本运算以及大小比较,乘法经过改进后基本没有问题
#include     
#include     
#include      
#include
#define LL long long     
using namespace std;     
struct bigint{     
    static const int base=1000000000;     
    static const int width=9;     
    vectors;     
    bigint (LL num=0){*this=num;}     
    bigint operator = (LL num){     
        s.clear();     
        do{     
            s.push_back(num%base);     
            num/=base;     
        }while(num>0);     
        return *this;     
    }     
    bigint operator = (const string& str){     
        s.clear();     
        int x,len=(str.length()-1)/width+1;     
        for(int i=0;i=s.size()&&i>=b.s.size())break;     
            int x=g;     
            if(i=s.size())break;     
            int x=g;     
            if(i1)  
            c.s.pop_back();  
        return c;  
    }  
    bool operator < (const bigint&b) const{     
        if(s.size()!=b.s.size())return s.size()=0;i--)     
            if(s[i]!=b.s[i])return s[i] (const bigint&b) const{return b<*this;}     
    bool operator <= (const bigint&b) const{return !(b<*this);}     
    bool operator >= (const bigint&b) const{return !(*this>b);}     
    bool operator != (const bigint&b) const{return b<*this|| *this=0;i--){     
        char buf[20];     
        sprintf(buf,"%09d",x.s[i]);     
        for(int j=0;j> (istream &in,bigint&x){     
    string s;     
    if(!(in>>s))return in;     
    x=s;     
    return in;     
}  
int main(){  
    bigint a,b;  
    cin>>a>>b;  
    cout<

你可能感兴趣的:(高精度专题)