这一个马踏棋盘的程序搞了很久都还是错误,到需要回溯的时候就发生错误,谁能帮我看下啊~~~~~程序如下:#include#include#defineN5templateclassStac...
这一个马踏棋盘的程序搞了很久都还是错误,到需要回溯的时候就发生错误,谁能帮我看下啊~~~~~
程序如下:
#include
#include
#define N 5
template
class Stack
{
public:
Stack(int MaxSize=N*N);
~Stack () { delete [] stack; }
inline bool IsEmpty() const { return (top==-1); }
inline bool IsFull() const { return (top==MaxTop); }
inline T Top() const;
inline Stack& Add(const T& x);
inline Stack& Delete(T& x);
private:
int top;
int MaxTop;
T *stack;
};
template
Stack::Stack(int MaxSize)
{
MaxTop=MaxSize-1;
stack=new T[MaxSize];
top=-1;
}
template