实现一个高精度无符号整数乘法的函数,函数原型为void Multiply(WORD *R, WORD* A, WORD *B, unsigned int N),其中R为结果,A与B为两个乘数,N为乘数的长度(单位为WORD)。WORD为你们定义的存储长整数每一部分的类型.(最好为2的32次方进制即每个数是以32位32位这样一个个整体构成的)大家帮帮忙??
...全文
5647打赏收藏
求程序(大整数的乘法)
实现一个高精度无符号整数乘法的函数,函数原型为void Multiply(WORD *R, WORD* A, WORD *B, unsigned int N),其中R为结果,A与B为两个乘数,N为乘数的长度(单位为WORD)。WORD为你们定义的存储长整数每一部分的类型.(最好为2的32次方进制即每个数是以32位32位这样一个个整体构成的)大家帮帮忙??
int main()
{
int a_length,b_length;
char a[MAXSIZE],b[MAXSIZE],temp[MAXSIZE];
int i,j=0;
printf("Please input the first number:\n");
scanf("%s",&a);
printf("Please input the second number:\n");
scanf("%s",&b);
printf("The data are:\n");
printf("a=%s\n",a);
printf("b=%s\n",b);
/*a_length=strlen(a);
b_length=strlen(b);
printf("after revising the data a and b are:\n");
for(i=a_length-1;i>=0;i--)
{
temp[j]=a[i];
j++;
}
temp[j]='\0';
strcpy(a,temp);
for(i=0;i<strlen(a);i++)
printf("%c",a[i]);
printf("\n");
j=0;
for(i=b_length-1;i>=0;i--)
{
temp[j]=b[i];
j++;
}
temp[j]='\0';
strcpy(b,temp);
for(i=0;i<strlen(b);i++)
printf("%c",b[i]);*/
printf("\n");
Multiply(a,b);
int main()
{
int a_length,b_length;
char a[MAXSIZE],b[MAXSIZE],temp[MAXSIZE];
int i,j=0;
printf("Please input the first number:\n");
scanf("%s",&a);
printf("Please input the second number:\n");
scanf("%s",&b);
printf("The data are:\n");
printf("a=%s\n",a);
printf("b=%s\n",b);
printf("\n");
Multiply(a,b);