使用两个栈,一个用于初始化迷宫,一个用于回溯。
#include <iostream>
#include <string>
#include <cstring>
#include <stack>
using namespace std;
template<class T>
class Stack:public stack<T>
{
public:
T pop(){
T tmp = stack<T>::top();
stack<T>::pop();
return tmp;
}
};
class Cell
{
private:
int x, y;
friend class Maze;
public:
Cell(int i = 0, int j = 0){
x = i;
y = j;
}
bool operator==(const Cell &c)const