Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help finishing this portion of my code. Will someone show me the code wit

ID: 3539261 • Letter: I

Question

I need help finishing this portion of my code. Will someone show me the code with some explanation please?:


BigInt& BigInt::operator+=(const BigInt& num2)
{
if(_digits.size()<num2._digits.size())
    _digits.resize(num2._digits.size(),0);

    for(int idx=0; idx<_digits.size(); idx++)
    {
      int right_digit;
      if (idx < num2._digits.size())
        right_digit = num2._digits[idx];
      else
        right_digit = 0;                                                      
      // I need help here. Each one of these indexes hold a single int        
      // It needs to loop through and add all of the index values              
      // If the value of the sum is greater than 9                             
      // Then a carry must be applied to the next sum                          
      // After the last two ints are added and there is a carry                
      // Then the _digits vector needs to be increased by one and              
      // The carry will be placed in this index.                               
      int carry = 0;
      _digits[idx] = _digits[idx]+right_digit+carry;

    }


}

Explanation / Answer

hey! I can help you out in this programming question and others if you just add me on skype...my skype id is mohammad.sarmad.junaid...

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote