For this project you will write a program to add very large (unsigned) integers.   
The two summands should be stored arrays, one array for each summand. The summands should be stored with one digit per location in the two arrays. Your program should, starting at the least significant digits, compute the sum by adding the two integers digit by digit. Do not forget to handle carries. Your program should be able to handle summands with up to 80 digits each.
Here is the test data for your program:
–First summand 9999999999999999999999999999999999
–Second summand

–First summand 1
–Second summand 9999999999999999999999999999999999

–First summand 9000000000000000000000009
–Second summand 9999999999999999999999999

–First summand 9999999999999999999999999
–Second summand 9999999999999999999999999

Notice that for the last two sets of test data both summands have the same number of digits.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

#include <iostream>

using namespace std;

//void reversearr(string arr, int start, int end)
// int temp;
//    while (start < end)
// {
    //    temp = arr.start();   
      // arr.start() = arr.end();
    //    arr.end() = temp;
      // start++;
    //    end--;

int main()
   // string arr1 = "1";
    //string arr2 = "9999999999999999999999999999999999";
   // string arr1 = "999999999999999999999999";
    //string arr2 ="999999999999999999999999";
    //string arr1="9000000000000000000000009";
    //string arr2="9999999999999999999999999";
   string arr1 ="999999999999999999999999999999999";
   string arr2="1";
   string aux,result = ""; //aux is a temporary string and result holds the resulting sum
    // we establish the bigger number to know how to write the loop which deals carry addition
    if (arr2.length() > arr1.length())

    // reverse arrays
    reverse(arr1.begin(), arr1.end());
    reverse(arr2.begin(), arr2.end());
    int carryout = 0;...

By purchasing this solution you'll be able to access the following files:
Solution.docx and

for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats