Write a C++ program that implements an ADT class named Int50 for manipulating integer numbers with up to 50 digits. The operators provided on this type must include: sum (+), difference (-), product (*), division (/) {dropping the remainder}, output (<<), and input (>>) of values for Int50 objects. Each number will be represented by an array of short int elements, each representing one decimal digit of the whole number. Allow for positive and negative values. The input (>>) operation must allow values formatted like 0, 247, -86, and +244 to be entered but for any number of digits up to 50. On output, do not print leading zeroes. Do not prompt the user for input in the ADT, that should only be done in the application code that uses the ADT class. Use the class in a program that gives the user the ability to enter data and perform each of the calculations. The operator overloading you provide must support expressions like:

N3 = N1+N2; //each variable is of type Int50

cout << "results: " << N4 << " & " << N5 << endl; // {might print -- results: -2738 & 74682354970035}

Bonus credit will be given for properly "throwing" an "exception" for division by zero and for overflow (number entered or produced exceeds 50 digits).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.