c++ 栈的顺序表示
来源:互联网 发布:php防止表单模拟提交 编辑:程序博客网 时间:2024/04/29 09:56
#include<iostream>using namespace std;class SqStack{private: int *elem; int stacksize; int top;public: SqStack(int n); ~SqStack(); void push(int i); int pop(); void StackTrav(); void GetTop();};SqStack::SqStack(int n){elem = new int[n];if(elem == NULL){cout<<"error"<<endl;}stacksize = n;top = -1;}SqStack::~SqStack(){delete[] elem;}void SqStack::GetTop(){cout<<elem[top]<<endl;}void SqStack::push(int i){ top++; elem[top] = i;}int SqStack::pop(){int w = elem[top];top -- ;return w;}void SqStack::StackTrav(){int m = top ;while(m >= 0){cout<<elem[m]<<" ";m--;}cout<<endl;}int main(){SqStack stack(10);stack.push(3);stack.StackTrav();stack.pop();stack.push(10);stack.push(14);stack.GetTop();stack.StackTrav();system("pause");return 0;}
0 0
- c语言顺序栈的表示和实现
- C语言队列的顺序表示
- 栈的顺序存储表示
- c++ 栈的顺序表示
- 栈的顺序存储表示
- 数据结构(16)顺序栈的表示和算法表示
- 顺序栈的表示和实现
- 顺序栈的表示和实现
- 栈的顺序表示与实现
- 栈的顺序表示和实现
- 栈的顺序表示和实现
- 栈的顺序表示和实现
- 栈的顺序表示和实现(数据结构)
- 栈的顺序表示和实现
- 栈的顺序表示和实现
- 栈的实现——顺序表示
- 栈的静态顺序存储表示
- 栈的动态顺序存储表示
- 时间日期格式化用法
- 闪回事务处理回退
- 关于jquery的load方法在ie7下面不能很好达到预想中问题的解决办法。
- 执行 sudo 命令下避免输入密码的两个方法
- http://home.gongkong.com/profile/blogdetail.aspx?id=2013120610242900001
- c++ 栈的顺序表示
- unix环境高级编程
- ZJU_BASIC LEVEL_1017 大数相除 递归的简单应用
- RabbitMQ消息队列(六):使用主题进行消息分发
- RabbitMQ消息队列(七):适用于云计算集群的远程调用(RPC)
- Socket通信简介
- sdut2773 小P的故事——神奇的Dota(完全背包)
- unity当中editorwindow in front的奥秘
- 张杰主动和品冠交换出场顺序 用实力征服我是歌手