hi,
i need help with this:
Assume that your computer has the very limited capability of being able to read and write only single-integer digits and to add two integers consisting of one decimal digit each. Write a program that can read two integers up to 30 digits each, add these integers together, and display the result. Test your program using pairs of numbers of varying lengths.
Hint: Store the two numbers in two int arrays of size 30, one digit per array element. If the number is less than 30 digits in length, enter enough leading zeros (to the left of the number) to make the number 30 digits long.
You will need a loop to add the digits in corresponding array elements. Don’t forget to handle the carry digit if there is one!
this is the code
#include <iostream>
#include <string>
#include <conio.h>
#include <iomanip>
using namespace std;
int main()
{
long int SIZE = 30;
long int integer1 = 0;
long int integer2 = 0;
cout << "Enter two integers: ";
for(int i=0; i<SIZE; i++)
cin >> integer1;
for(int i=0; i<SIZE; i++)
cin >> integer2;
getch();
return 0;
}