摘要: 用顺序结构(数组)与模板技术实现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) ... 阅读全文
posted @ 2012-10-16 09:52 zhoutk 阅读(298) 评论(0) 推荐(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> 阅读全文
posted @ 2012-10-16 00:49 zhoutk 阅读(325) 评论(0) 推荐(0) 编辑