数据结构用栈实现大数加减出现stackoverflow

没有报错但是调试代码出现这个

img

以下是我的代码


#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
using namespace std;
const int N = 1.0e+8;
struct stack {
    void Push(char x);
    void Pop();
    bool IsEmpty();
    bool IsFull();
    char Gett();
    char top=-1, len=0;
    char st[N];
};

void stack::Push(char x)
{
    top++;
    st[top] = x;
    len++;
}
void stack::Pop()
{
    top--;
    len--;
}
bool stack::IsEmpty()
{
    if (top < 0)
        return true;
    return false;
}
bool stack::IsFull()
{
    if (top < N - 1)
        return false;
    return true;
}
char stack::Gett()
{
    return st[top];
}
string Max(string x, string y)
{
    if (x.size() > y.size())
        return x;
    return y;
}
string Min(string x, string y)
{
    if (x.size() <= y.size())
        return x;
    return y;
}
int main()
{
    stack st1, st2;
    string data1, data2;
    long long sum = 0;
    int  n = 0, extra = 0;
    cin >> data1;
    cin >> data2;
    long long length1 = data1.size();
    long long length2 = data2.size();
    int tag = max(length1, length2) - min(length1, length2);
    for (int i = 0; i < tag; ++i)
    {
        st1.Push(0);
    }
    for (int i = 0; i < min(length1, length2); ++i)
    {
        st1.Push(Min(data1, data2)[i]);
    }
    for (int i = 0; i < max(length1, length2); ++i)
    {
        st2.Push(Max(data1, data2)[i]);
    }
    while (!st1.IsEmpty())
    {
        sum += ((st1.Gett() + st2.Gett() + extra) % 10) * pow(10, n);
        extra = (st1.Gett() + st2.Gett()) / 10;
        st1.Pop();
        st2.Pop();
        n++;
    }
    cout << sum;
    return 0;
}

数据量有多大哦,堆栈溢出了stackoverflow

调试的时候看你出错的代码中的位置,你第一个图不是你代码的东西。在调试窗口找到你代码的那一行