hi,i have to implement multiplication of two huge integers of 40 or more digits.i've made a function in a class for its implementation but its not working.plz help if u find any logical errors in it.
void HugeInteger::multiplyHugeIntegers(HugeInteger H1,HugeInteger H2)
{
int carry=0;
int count=0; // introduced to place the result in proper place in final answer
int k; //index of veryhugeint (the array to store the final result)
for (int i=max-1;i>=0;i--)
{
for (int j=max-1,k=(max+max);j>=0;j--)
{
temp[j]=H1.intarray[i]*H2.intarray[j]; //temp[j] and intarray are two int arrays
temp[j]=temp[j]%10;
carry=temp[j]/10;
// veryhugeint is initialized in a constructor in the class
veryhugeint[k-count-1]+=carry; //result stored in the final array
veryhugeint[k-count]+=temp[j]; // result stored in the final array
count++;
k--;
}
}
.
if you know any other logic or algorithm for its implementation plz reply.thanks