Question: The code needs to be c++ Write a program that reads two positive integers that are of arbitrary length and then outputs the sum of

The code needs to be c++

Write a program that reads two positive integers that are of arbitrary length and then outputs the sum of the two numbers. Your program will read the digits as values of type char so that the number 1234 is read as the four characters '1', '2', '3', and '4'. As the characters are read they are changed to values of type int and stored in a list. (Now you can see the first reason why storing the digits backwards has an advantage.) After the first number has been read your program reads the second number, storing it in a second list.

Your program will perform the addition by implementing the usual paper-and-pencil addition algorithm. (Now you should discover the second reason why storing the digits backwards is advantageous.) The result of the addition is stored in a list and the result is then written to the screen. Include a loop that allows the user to continue to do more additions until the user says the program should end.

Of course, your multiple precision addition code should be formulated as a function that accepts a pair of lists, returning a list as its result (the sum of the two inputs).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!