main.cpp
来自「数据结构与程序设计教材源码 数据结构与程序设计教材源码」· C++ 代码 · 共 28 行
CPP
28 行
#include "../../C/UTILITY.H"
#include "../../C/UTILITY.CPP"
#include "QUEENS.H"
#include "QUEENS.CPP"
int main()
/*
Pre: The user enters a valid board size.
Post: All solutions to the n-queens puzzle for the selected
board size are printed.
Uses: The class Queens and the recursive function solve_from.
*/
{
int board_size;
print_information();
cout << "What is the size of the board? " << flush;
cin >> board_size;
if (board_size < 0 || board_size > max_board)
cout << "The number must be between 0 and " << max_board << endl;
else {
Queens configuration(board_size); // Initialize empty configuration.
solve_from(configuration); // Find all solutions extending configuration.
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?