For this program I am supposed to add two numbers together, up to 20 digits, using arrays...i have most of it working but i cant figure out how to solve the carrying over problem when the two numbers added are greater than 9....here is what i have so far
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int count = 0, number;
char first[20], second[20], sum[21];
{
cout << "Enter the augend: ";
cin >> noskipws >> first[0];
cout << endl;
while( first[count] != '\n')
{
count++ ;
cin >> first[count];
}
for ( number = count-1; number >= 0; number--)
cout << endl;
count=0;
cout << "Enter the adden: ";
cin >> noskipws >> second[0];
cout << endl;
while( second[count] != '\n')
{
count++;
cin >> second[count];
}
for(number = count-1; number >= 0; number--)
cout << endl;
}
number=0;
for(number=0;number<count;number++)
{
sum[number] = (first[number]-'0'+second[number]-'0')+'0';
cout << sum[number];
}
cout << endl;
return 0;
}
i know i have to do something with and if(sum[number] >=10) but i dont know where to go from there, any help would be great!