#include<iostream>
using namespace std;
#define LOCAL
void fun(int the_date,int the_numb,int the_lenth_num1,char the_num1[],int the_ans[]);
int main()
{
#ifdef LOCAL
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
#endif
///
char num[100];
//input the array
cout<<"The big number is:"<<endl;
cin >>num;
char *num1=new char[strlen(num)+1];
strcpy(num1,num);
cout<<"Your input is:"<<num1<<endl;
///
cout<<"The other number is:"<<endl;
cin>>num;
char *num2=new char[strlen(num)+1];
strcpy(num2,num);
cout<<"Your input is:"<<num2<<endl;
//the lenth of two number
int lenth_of_num1=strlen(num1);
cout<<lenth_of_num1<<endl;
/
int lenth_of_num2=strlen(num2);
cout<<lenth_of_num2<<endl;
int lenth=lenth_of_num1+lenth_of_num2;
cout<<lenth<<endl;
int *ans = new int[lenth];
for(int i=0;i<lenth;i++){
ans[i]=0;
}
//
//get the number from num1
int numb=0;
for(int date = 0;lenth_of_num2>0;lenth_of_num2--,date++)
{
numb=num2[lenth_of_num2-1]-'0';
//cout<<"$$$$$"<<numb<<endl;
fun(date,numb,lenth_of_num1,num1,ans);//the function
// for(int b=)
}
//
int k;
for(k=0;k<lenth-1;k++)//carefully :if write "k<lenth",the "k+1" will equal to 'lenth'
//the array will biger than ans[lenth].
{
ans[k+1]+=ans[k]/10;
ans[k]%=10;
//cout<<ans[k]<<endl;
}
//output the anser
cout<<"the anser is:";
for(;k>=0;k--)
{
if(
(k==lenth-1)
&&
(ans[k]==0)
)
continue;
else cout<<ans[k];
}
cout<<endl;
return 0;
}
///
void fun(int the_date,int the_numb,int the_lenth_num1,char the_num1[],int the_ans[])
{
int a;
int b;
b=the_date ;
for(;the_lenth_num1>0;the_lenth_num1--,b++)
{
a=the_num1[the_lenth_num1-1]-'0';
the_ans[b]+=(a*the_numb);
}
}