In this excersize you will write a program that reads in two positive intigers that are 20 or fewer digits in length and then outputs the sum of the two numbers. Your program will read in the digits as values of type char so that the number 1234 is read as the four characters '1' '2' '3' '4'. After they are read into the program, the characters are changed to values of type int. The digits will be read into a partially filled array, and you might find it useful to revers the order of the elements in the array after the array is filled with data from the keyboard.
Your program will perform the addition but implementing the usual pap-and-pencil addition algorithm.The result is stored in an array of size 20, and the result is then written to the screen. If the result is more than 20 digits then your program should issue a message saying "Integer Overflow".
I understand what the final part is asking, but am I on the right track so far?
#include <iostream>
using namespace std;
// Sets the Maximum allowed number of digits to be entered in the array.
const int Max_Number = 20;
// Input function for the numbers
void input_Large_Int ( int a[], int& size_of_A );
// Outputs the sum of the 2 numbers
void output_Large_Int ( int a[], int size_of_A );
// The sum function for the program
void add ( int a[], int size_of_A, int sum[] );
int main()
{
//Declares the arrays
int a[Max_Number], b[Max_Number], sum[Max_Number];
int size_of_A,
char response='y';
while (response == 'y' || response == 'Y')
{
input_Large_Int( a, size_of_A );
}
cout << "Would you like to add two more numbers? ( Y-Yes, N-No ):" << endl;
cin >> response;
cout << endl;
}
void input_Large_Int ( int a[], int& size_of_A )
{
char num_1 [Max_Number], num_2 [Max_Number];
cout << "Please input the first number that has less than 20 numbers: " << endl;
cin >> num_1;
cout << endl;
cout << "Please input the second number that has less than 20 numbers: " << endl;
cin >> num_2;
cout << endl;
}