board.h

来自「Data Abstraction & Problem Solving with 」· C头文件 代码 · 共 54 行

H
54
字号
// ****************************************************// Header file Board.h // ****************************************************#ifndef BOARD_H#define BOARD_H#include "Queen.h"#include <vector>#include <cassert>#include <iostream>using namespace std;static const int BOARD_SIZE = 8;class Board {public:    Board();  // Supplies the Queen class with a pointer to the board.    ~Board(); // Clears the board and removes pointer from queens.        void clear();         // Clears board.    void display() const; // Displays board.        void doEightQueens();      // Initiates the Eight Queens problem.    int getNumQueens() const;    // Returns the number of queens on the board.        const Queen *getQueen(int index) const;    // Returns a pointer to the queen at the designated index.	private:    bool isQueen(int inRow, int inCol) const;    // Determines whether there is a queen in position (inRow, inCol).    bool placeQueens(Queen *queenPtr);    // Attempts to place queens on board     // starting with the designated queen.    void removeQueen();    // Removes the last queen on the board, but does not delete it.    void setQueen(const Queen *queenPtr);    // Places a queen on the board.    	    vector<const Queen *> queens;  // array of queens on the board};#endif    

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?