How can I multiply really big numbers c++

前端 未结 9 1668
梦谈多话
梦谈多话 2021-01-18 10:09

I have the following code

      int i, a, z;
i = 2343243443;
a = 5464354324324324;
z = i * a;
cout << z << endl;

When these are

9条回答
  •  生来不讨喜
    2021-01-18 10:41

    // its may heplfull for you
    #include
    #include
    #include
    #include
    #define MAX 1000
    void reverse(char *from, char *to ){
        int len=strlen(from);
        int l;
        for(l=0;lr) r=f+s;
            }
            while(hold!=0){
                res=hold+temp[f+s]-'0';
                hold=res/10;
                temp[f+s]=res%10+'0';
                if(r0 && temp[r]=='0';r--);
        temp[r+1]='\0';
        reverse(temp,result);
    }
    int main(){
        char fir[MAX],sec[MAX],res[MAX];
        while(scanf("%s%s",&fir,&sec)==2){
            call_mult(fir,sec,res);
            int len=strlen(res);
            for(int i=0;i

提交回复
热议问题