0

Ok I have been working on this program for some time now. The program is to take any number of any size and then add them together. After which it will print out the result. The problem I am having is that the gut of the add function seems to be working except that the numbers are being added in the wrong place.

Here is the adding function:

```
int largeinteger::addbignumbers(){
strl1=str1.length();
strl2=str2.length();
int num1[strl1];
int num2[strl2];
int sum=0,carry=0,ascii;
total[strl1+1];
carry=0;
for(int i=0; i<strl1; i++){
num1[i]=0;
num2[i]=0;
total[i]=0;
}
for(int i=strl1-1; i>=0; i--){ //backwards
//for(int i=0; i<strl1; i++){
ascii=str1[i];
ascii=(ascii-48);
num1[i]=ascii;
cout<<num1[i];
}
cout<<endl;
for(int i=strl2-1; i>=0; i--){ //backwards
//for(int i=0; i<strl2; i++){
ascii=str2[i];
ascii=(ascii-48);
num2[i]=ascii;
cout<<num2[i];
}
cout<<endl;
for(int x=strl1; x>=0; x--){ //backwards
//for(int x=0; x<strl1; x++){ //forwards
sum=num2[x]+num1[x]+carry;
if(sum>9){
sum=sum-carry;
carry=1;
}
else{
carry=0;
}
sum=sum-carry;
total[x]=sum;
cout<<total[x];
}
cout<<endl;
}
void largeinteger::print(){
for(int i=0; i<strl1; i++)
cout<<total[i];
}
```

Please help me with this problem, I think I have tortured myself everyway possible getting this to work. Thanks in advance guys!