queen.h
来自「Data Abstraction & Problem Solving with 」· C头文件 代码 · 共 37 行
H
37 行
// ****************************************************// Header file Queen.h // ****************************************************#ifndef QUEEN_H#define QUEEN_Hclass Board;class Queen {public: Queen(); // Puts queen in upper left corner of board. Queen(int inRow, int inCol); // Places Queen in supplied location. int getCol() const; // Returns column number. int getRow() const; // Returns row number. void nextRow(); // Moves queen to next row. bool isUnderAttack() const; // Determines whether the queen is under attack by another queen. // If there is a queen in the same row or the same diagonal, // returns true; otherwise, returns false. static void setBoard(const Board *bPtr); // Saves a pointer to the board for all queens.private: // Row and column of queen if it is on the board. // Otherwise, prospective row and column of queen. int row; int col; static const Board *boardPtr; // All queens share the same board.};#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?