这是我写的高精乘法代码,不知道为啥运行结果出不来?
#include<bits/stdc++.h>
using namespace std;
int a[2010],b[2010],c[2010];
void init(int a[]){
string s;
cin>>s;
a[0]=s.length();
for(int i=1;i<=a[0];++i){
a[i]=s[a[0]-i]-'0';
}
}
void mlp(int m[],int n[]){
int x;
for(int i=1;i<=m[0];++i){
for(int j=1;j<=n[0];++j){
c[i+j-1]+=a[i]*b[j]+x;
x=c[i+j-1]/10;
c[i+j-1]%=10;
}
}
}
int main(){
init(a);
init(b);
mlp(a,b);
if(!c[c[0]])c[0]--;
for(int i=c[0];i>=1;i--){
printf("%d",c[i]);
}
return 0;
}
代码运行不了,我连调试都出不来ToT
恳请各位大佬指教