|
Queens
solvequeens.cpp
// solvequeens.cc
//
// Charles A. Cusack, August 2000
//
// Show the solution to the Non-Attacking Queens Problem.
// Usage:
// solvequeens n
// where n is the dimension of the board.
//
//-------------------------------------------------------------------------
#include "queens.h"
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
int main (int argc,char* argv[]) {
if(argc!=2 ) { // Check for correct number of command line arguments.
cout<<"USAGE: "<<argv[0]<<" number\n";
exit(1);
}
int size=atoi(argv[1]);
Queens Q(size);
if(Q.PlaceQueens(0))
Q.DisplayBoard();
else
cout<<"There is no solution\n";
return 0;
}
//-------------------------------------------------------------------------
|