= SSize) return false; else { data[Top] = d; Top++; return true; }} bool Stack::Pop(SType &d) { if (!Top) return false; else{ Top--; d= data[Top]; return true; }} bool Stack::StackTop(SType &d) { if (!Top) return false; else {d= data[Top-1]; return true; }} // 对栈的预先处理结束 enum States { used, free }; class Board // 一盘棋 8*8 // 声明类{ private: char board[8][8]; States Rows[8], DiagsLR[15], DiagsRL[15]; char PrintBoard[100][8][8]; public: Board(); ~Board(){} bool isAttacked(int, int); void PlaceQueen(int, int); void RemoveQueen(int, int); bool isIn(int row,int col); // 确保所有的皇后不出棋盘 void Save_Board(int); void Print5board(int , int); // 五个一次打印棋盘 friend Print1(int , Board); // 拿五个棋盘出去打印}; Board::Board() // 构造函数,初始化为空{ for(int i=0; i<8; i++) { Rows[i] = free; for(int j=0; j<8; j++) board[i][j] = '.'; }