Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*please include title of the files as following LargeInt.h, largeInt.cpp, and main.cpp along the code from each file also plz follow all guidelines. Write and

*please include title of the files as following LargeInt.h, largeInt.cpp, and main.cpp along the code from each file also plz follow all guidelines. Write and test an Object-Oriented C++ program to perform math operations on very large integers.

In C++, the largest int value is 2,147,483,647 (10 digits), and the largest long long value is 9,223,372,036,854,775,807 (19 digits). So, a value larger than these cannot be stored and processed as an integer. Similarly, if the sum or product of two positive integers is greater than either of these values, the result will be incorrect. One way to store and manipulate large integers is to store each individual digit of the value as an element of an array (or vector). Consider the following issues when developing your solution to this problem. Define a class named LargeInt that holds one integer value with as many digits as the user needs (at least 50). Use an array or vector to hold the digits of the stored value. Include constructor(s) and methods to manage and operate on the value. The constructor(s) and input methods must accept values as strings containing only decimal digits. The only math operation that MUST be included is addition. Be sure to include a method that will format the value for output as a string. Implement three objects of the LargeInt class within function main(). Input two large numbers (as strings) from the user to initialize two of the LargeInt objects. Initialize the third LargeInt object to zero, and add the other two LargeInt values into it. Display the two input values and their sum. Repeat the process of inputting two large numbers, adding them together, and displaying the result until the user opts to quit. Coding Each class must be defined within its own set of .h and .cpp files. Use the provided main() function, with your own edits and additions, to complete this project. The program must accept any valid unsigned integer input as a string of decimal digits. Validate all inputs and do not proceed until valid values are entered. Format your source code according to the style guide presented in class. Hints Read input values as strings and store the digits of the value in an array or vector. Store the ones digit in element 0 of the array/vector. Remember how you were taught to do addition with pencil and paper. Use that same method here.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions