printf("%d",B[i]);
printf("n");
Multiply(C,A,B,LenA);//A和B相乘,结果放C数组中
//以下是测试程序
printf("******************************************************");
printf("nThe Following is The Testing Sectionn");
int TestArrayResult[161];
int TestArrayA[]={9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9,
9,9,9,9,9,9,9,9,9,9};
int TestArrayB[]={0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0};
printf("The first Testing: 80个9乘以80个0nThe Result is:n");
Multiply(TestArrayResult,TestArrayA,TestArrayB,80);
printf("n");
printf("The second Testing: 80个9乘以80个9nThe Result is:n");
Multiply(TestArrayResult,TestArrayA,TestArrayA,80);
printf("n");
printf("The third Testing: 80个0乘以80个0nThe Result is:n");
Multiply(TestArrayResult,TestArrayB,TestArrayB,80);
printf("n");
printf("Random Testing:(TestLength can be changed)n");
srand((unsigned int) time (NULL));
//生成第一个随机数,作为第一个乘数
printf("The first Random Number:n");
for(i=0;i
{
M[i]=rand()%10;
printf("%d",M[i]);
}
printf("n");
//生成第二个随机数,作为另一个乘数
printf("The Second Random Number:n");
for(j=0;j
{
N[j]=rand()%10;
printf("%d",N[j]);
}
printf("n");
//M和相乘,结果放在D数组中
Multiply(D,M,N,TestLength);
system("PAUSE");
return 0;
}
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/721601/viewspace-751358/
,如需转载,请注明出处,否则将追究法律责任。