请问高精度幂为什么这么求啊 不懂那个caculate函数(语言-c++)


#include<iostream>
using namespace std;

class BigInt
{
public:
    int n;
    int a[10000];
public:
    BigInt(int x)
    {
        n = 0;
        while (x > 0)
        {
            a[n++] = x % 10;
            x = x / 10;
        }
    }
    void Output();
    void Caculate(int x, int k);
};
void BigInt::Output()
{
    for (int i = n - 1; i >= 0; i--)
    {
        cout << a[i];
    }
}
void BigInt::Caculate(int x, int k)
{
    for (int i = 0; i < k - 1; i++)
    {
        int l = 0;
        for (int j = 0; j < n; j++)
        {
            l += a[j] * x;
            int t = l;
            l = t / 10;
            a[j] = t % 10;
        }
        while (l > 0) 
        {
            a[n++] = l % 10;
            l /= 10;
        }
    }
}
int main()
{
    int x, k;
    cin >> x >> k;
    BigInt b(x);
    b.Caculate(x, k);
    b.Output();
}

跟手算差不多

void BigInt::Caculate(int x, int k)
{
    for (int i = 0; i < k - 1; i++) //计算k-1次x乘以x,一开始BigInt里已经用数组存了一个x
    {
        int l = 0;
        for (int j = 0; j < n; j++)//按位乘,从个位开始
        {
            l += a[j] * x; 
            int t = l;
            l = t / 10; // 计算进位
            a[j] = t % 10; //计算当前位置的数字
        }
        while (l > 0) //如果计算结果大于原数的位数,继续向前进位
        {
            a[n++] = l % 10;
            l /= 10;
        }
    }
}