STL的栈,可能有一些不需要的信息。
其实用数组实现之后是这个鬼样子。感觉还不如直接用。

struct Stack{
    int st[MAXSIZE];
    int top;
    inline void Clear(){
        top=0;
    }
    inline void Push(int x){
        st[++top]=x;
    }
    inline void Pop(){
        --top;
    }
    inline int Top(){
        return st[top];
    }
    inline int Size(){
        return top;
    }
    inline bool Empty(){
        return !top;
    }
};

相关文章:

  • 2021-11-15
  • 2022-12-23
  • 2021-10-03
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-24
  • 2021-10-15
猜你喜欢
  • 2022-01-22
  • 2021-10-16
  • 2021-10-20
  • 2022-01-07
  • 2022-12-23
  • 2022-12-23
  • 2022-02-19
相关资源
相似解决方案