Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In C++ The input file contains several pairs of integers of arbitrary length. Data is terminated by a line containing-1 only. Your program must read
In C++
The input file contains several pairs of integers of arbitrary length. Data is terminated by a line containing-1 only. Your program must read two integers from the file. The built-in data types such as int and long have a maximum fixed length so variables of these types cannot be used to input the integers from the file. Each large integer must be read from the file and stored in a singly linked list, one digit per node The least significant digit of the large intcger must be storod at the top of the list and the most significant digit must be stored at the end of the list. Assume that each large integer has at most 50 digits. After creating the linked lists for the two large integers, you must find the sum of the integers. This sum must be stored in another linked list. Finally, your program must display the two large integers, exactly as they were read from the file as well as their sum. See Example 1 and Example 2 for the format required. [PTO Input: Large Integer 1: 957994954495949457454 Large Integer 2: 774874754744875847484 Your output should be similar to this: 957994954495949457454 774874754744875847484 1732869709240825304938 Example 1 Input: Large Integer 1: 80485080443358 Large Integer 2: 4849850549686868696 Your output should be similar to this 80485080443358+ 4849850549686868696 4849931034767312054 Example 2 Data are terminated by-1 957994954495949457454 80485080443358 774874754744875847484 4849850549686868696 77777678 9999999999 5555555555 44444444444444444465Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started