hello all. I'm a beginning programmer and I thought that I would try to write a program that would take a digit and raise it to a large number. It works pretty well and all, but it starts returning all zeros for number larger than 4^15. I would appreciate it if anyone could tell me why? Thank you
int add=0;
int mypow=0;
int diff=0;
int base=0;
int carry=0;
int lnumber[99]={0};
///////////////////////////////////////////////
void remain(int fnum, int fnum2)
{
for (int k=0; k<100; k+=10)
{
if (fnum*fnum2>=k)
{diff=fnum*fnum2-k;carry=k/10;break;}
}
}
//////////////////////////////////////////////
void mult(int farr[], int foper)
{
for (int i=99; i>0; i--)
{
add=carry;
remain(farr[i], foper);
farr[i]=diff+add;
}
}
////////////////////////////////////////////
void power(int farr2[],int fexp,int fbase)
{
for (int i=1;i<fexp;i++)
{mult(farr2,fbase);}
}
////////////////////////////////////////
#include <iostream>
using namespace std;
int main()
{
cout<<"enter base";
cin>>base;
cout<<"enter exponent";
cin>>mypow;
lnumber[99]=base;
power(lnumber,mypow,base);
for (int i=0;i<100;i++) {cout<<lnumber[i];}
return 0;
}