⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 queenchess.h

📁 queenchess类的测试函数, 求解八皇后问题,本程序给出了所有可能解.
💻 H
字号:
// QueenChess类的声明

#ifndef QUEENCHESS_H_
#define QUEENCHESS_H_

#include<iostream>
#include<vector>
#include<string>

using namespace std;

class QueenChess
{
	public:
		QueenChess();	// 构造函数
		void Solve();
		  // 求解八皇后问题,并给出放置成功的棋盘	       	
	private:
		string chessState[8];
		  // 用于存放棋盘状态
		int solves;
		  // 八个皇后放置成功的棋盘解的总个数
		bool SafeJudge( int row, int col) const;
		  // 判断位置(row, col) 是否安全
		void PlaceQueen( int row);
		  // 在第row行放置一个皇后
		void DrawChess() const;
          // 打印八个皇后放置成功的棋盘
};
#endif

⌨️ 快捷键说明

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