NEFU锐格数据结构实验(二)
发布时间
阅读量:
阅读量
文章结构概述
1.8563 顺序栈的实现
#include <bits/stdc++.h>
using namespace std;
#define maxsize 100
typedef struct{
int *base;
int *top;
int msize;
}Stack;
void init(Stack &a){
a.base=new int[100];
a.top=a.base;
a.msize=maxsize;
}
void push(Stack &a,int e){
*a.top++=e;
}
void pop(Stack &a){
*a.top--;
}
void top(Stack a){
cout<<*(a.top-1)<<' ';
}
int main()
{
Stack a;
init(a);
int e;
全部评论 (0)
还没有任何评论哟~
