I'm supposed to write a program that would add 2 integers of up to 300 digits. I implemented the use of an array list with a header file, but I keep getting error messages that I can't figure out. Can anyone offer some assistance?
#include <iostream>
#include <iostream>
#include "arrayListType.h"
usingnamespace std;
int main()
{
arrayListType<int> int1, int2;
int total [300];
int number;
cout << "Enter the first line of digits:" << endl;
cin >> number;
for (int i = 0; i < 20 ; i++)
{
cin >> number;
int1.insert(number);
}
int number2;
cout << "Enter the second line of digits:" << endl;
cin >> number2;
for (int i = 0; i < 20 ; i++)
{
cin >> number2;
int2.insert(number2);
}
int carryOver = 0;
int num = 0;
for (int i = 9; i>= 0; i--)
{
number = int1. + int2[i];
if (num > 9)
{
num -= 10;
total[i] = num + carryOver;
carryOver = 1;
}
else
{
total[i] = num + carryOver;
carryOver = 0;
}
for (int i = 0; i < 10; i++)
{
cout << total[i];
}
return 0;
}
}