摘要:
用顺序结构(数组)与模板技术实现Stack如下:View Code class MyStack <T> { private const int MAXSTACK = 10; private int count; private T[] entry = new T[MAXSTACK]; public MyStack() { count = 0; } public bool empty() { bool outcome = true; if (count > 0) ... 阅读全文
摘要:
用顺序结构(数组)与模板技术实现Stack如下:View Code const int MAXSTACK = 10;template<class T>class ZtkStack{public: ZtkStack(); bool empty() const; ErrorCode pop(); ErrorCode top(T &item) const; ErrorCode push(const T &item);private: int count; T entry[MAXSTACK];};template<class T>ZtkStack<T> 阅读全文