11111111111111111111
22222222222222222222
-----------------------------
33333333333333333333
I dont know why when I enter more then 9 digits the code KABOOOM!!!...LOL. Any sugestion are welcome.
#include <iostream>
#include <cstdlib>
using namespace std;
const int n=30;
void Sum( string num1[n],string num2[n])
{
int num3[n], num4[n],total[n];
num3[n]=atoi(num1[n].c_str());
num4[n]=atoi(num2[n].c_str());
total[n]=num3[n]+num4[n];
cout<<"TOTAL = "<<total[n]<<endl;
}
int main()
{
string x[n];
string y[n];
cout<<"Enter a number of 20 digits: "<<endl;
cin>>x[n];
cout<<"Enter another number of 20 digits: "<<endl;
cin>>y[n];
Sum(x,y);
system ("pause");
return 0;
}
This post has been edited by bortiz0823: 08 September 2007 - 04:49 PM

New Topic/Question
Reply




MultiQuote





|