📄 stack.h
字号:
/////////////////////////////////////////////////////////////////////
/*
Name: stack.h
Author: 罗丹
Description: 用于记录探索路径的栈类头文件
*/
#include<iostream>
#include"fstream"
using namespace std;
class DataType //定义描述迷宫中当前位置的结构类型
{public:
int x; //x代表当前位置的行坐标
int y; //y代表当前位置的列坐标
int pre; //pre表示移动到下一步的方向
};
class Move //定义下一个位置的方向
{ public:
int x;
int y;
};
class Node //链表结点
{public:
DataType data;
Node *next;
};
//下面定义栈
class stack
{private:
Node *top; //指向第一个结点的栈顶指针
public:
stack(); //构造函数,置空栈
~stack(); //析构函数
void Push(DataType data);//把元素data压入栈中
DataType Pop(); //使栈顶元素出栈
DataType GetPop(); //取出栈顶元素
void Clear(); //把栈清空
bool IsEmpty(); //判断栈是否为空,如果为空则返回1,否则返回0
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -