
C++中顺序栈的实现(数据结构)
5星
- 浏览量: 0
- 大小:None
- 文件类型:None
简介:
本篇文章介绍了如何在C++中实现顺序栈的数据结构,包括栈的基本操作如入栈和出栈等,并提供了代码示例。
本程序通过C++实现数据结构中的顺序栈,主要功能包括压栈、弹栈、遍历以及栈空间拓展等。具体的函数如下:
- MStack(int tCapacity, bool& flag);
- ~MStack();
- void Clear();
- bool Empty() const;
- bool Push(ElemType&);
- bool Pop(ElemType&);
- bool GetTopElem(ElemType&) const;
- bool traverse(void(*visit)(const ElemType&)) const;
- int GetCapacity() const;
此外,声明了友元函数:
template
全部评论 (0)
还没有任何评论哟~


