⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dstack.h

📁 data structures, algorithms and Application书的源代码
💻 H
字号:
// file dstack.h

#ifndef Stack_
#define Stack_

#include "llista.h"
#include "xcept.h"


template<class T>
class Stack : private LinearList <T> {
// LIFO objects
   public:
      Stack(int MaxStackSize = 10)
        : LinearList<T> (MaxStackSize) {}
      bool IsEmpty() const
           {return LinearList<T>::IsEmpty();}
      bool IsFull() const
         {return (Length() == GetMaxSize());}
      T Top() const
         {if (IsEmpty()) throw OutOfBounds();
          T x; Find(Length(), x); return x;}
      Stack<T>& Add(const T& x)
         {Insert(Length(), x); return *this;}
      Stack<T>& Delete(T& x)
         {LinearList<T>::Delete(Length(), x);
          return *this;}
};

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -