HugeInt HugeInt::operator*( const HugeInt &op2 )const { HugeInt temp,result; int
ID: 3617912 • Letter: H
Question
HugeInt HugeInt::operator*( const HugeInt &op2 )const
{
HugeInt temp,result;
int upMul=0;
for( intj=29;j>=0;j-- )
{
for(inti=29,a=j;i>=0;i--,a--)
{
temp.integer[a]= ((integer[i] *op2.integer[j])%10) + upMul;
upMul=((integer[i]*op2.integer[j])/10);
}
result=result+temp;
}
return result;
Explanation / Answer
please rate - thanks HugeInt HugeInt::operator*( const HugeInt &op2 ) const { HugeInt temp; int i,j,k,tmp; for(i=0; i=1;i--) { k=i; for (j=29; j>=1;j--) {tmp =integer[ j ] * op2.integer[i]; temp.integer[k] =temp.integer[k]+tmp; temp.integer[k-1] =temp.integer[k-1]+temp.integer[k]/10; temp.integer[k] %=10; k--; if(k==0) j=0; } } return temp; }Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.