void mul(int a1[MAX],int a2[MAX],int *c) { int i,j; int y; int x; int z; int w; int l1, l2; l1=a1[MAX-1]; l2=a2[MAX-1]; if (a1[MAX-2]=='-'&& a2[MAX-2]=='-') c[MAX-2]=0; else if (a1[MAX-2]=='-') c[MAX-2]='-'; else if (a2[MAX-2]=='-') c[MAX-2]='-'; for(i=0;i<l1;i++) { for(j=0;j<l2;j++) { x=a1[i]*a2[j]; y=x/10; z=x%10; w=i+j; c[w]=c[w]+z; c[w+1]=c[w+1]+y+c[w]/10; c[w]=c[w]%10; } } w=l1+l2; if(c[w-1]==0)w=w-1; c[MAX-1]=w; return; }
目前暂无任何回答
- 0 回答
- 0 关注
- 546 浏览
添加回答
举报
0/150
提交
取消