0001 #include "queen_stack.h" 0002 0003 Rank N = 0; //棋盘大小 0004 0005 void displayRow ( Queen& q ) { //打印当前皇后(放置于col列)所在行 0006 printf ( "%2d: ", q.x ); 0007 Rank i = 0; 0008 while ( i++ < q.y ) printf ( "[]" ); 0009 printf ( "█" ); 0010 while ( i++ < N ) printf ( "[]" ); 0011 printf ( "%2d\n", q.y ); 0012 } 0013 0014 void displayProgress ( Stack<Queen>& S, Rank nQueen ) { //在棋盘上显示搜查的进展 0015 system ( "cls" ); 0016 N = nQueen; S.traverse ( displayRow ); 0017 if ( nQueen <= S.size() ) { 0018 cout << nSolu << " solution(s) found after " << nCheck << " check(s)\a"; 0019 getchar(); 0020 } 0021 }