📄 stackimplement.h
字号:
//
//****************************栈及其操作实现的头文件************************
// StackImplement.h
// 本模块使用顺序存储实现栈
// wjluo,2004年3月4日
//**************************************************************************
//
#ifndef _WENJIAN_LUO_STACK_IMPLEMENT_H_
#define _WENJIAN_LUO_STACK_IMPLEMENT_H_
#define OK 1
#define ERROR 0
#define OVERFLOW -2
//***********************坐标定义*********************//
typedef struct{
int x,y; //横坐标和纵坐标
}PositionType;
//***********************栈元素类型定义*********************//
typedef struct{
int ord; //通道块在路径上的“序号”
PositionType seat; //通道块在迷宫中的坐标位置
int di; //从此通道走向下一通道块的“方向”
}SElemType;
//**********************顺序栈定义************************************
#define STACK_INIT_SIZE 100 //存储空间初始分配量
#define STACKINCREMENT 10 //存储空间分配增量
typedef struct{
SElemType *base; //栈底指针
SElemType *top; //栈顶指针
int stacksize; //已分配存储量,一元素为单位
}SqStack;
//*********************基本操作的函数原型说明*************************
short int InitStack(SqStack &S); //构造一个空栈S
short int DestroyStack(SqStack &S); //销毁栈S
short int ClearStack(SqStack &S); //清空栈S
short int StackEmpty(SqStack S); //若栈S为空,返回True,否则返回False
short int StackLength(SqStack S); //返回栈S中的元素个数
short int GetTop(SqStack S, SElemType &e); //栈不空则返回栈顶元素,否则返回False
short int Push(SqStack &S, SElemType e);
short int Pop(SqStack &S, SElemType &e);
#endif /*#ifndef _WENJIAN_LUO_STACK_IMPLEMENT_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -