本文整理汇总了C++中Sudoku::print_Board方法的典型用法代码示例。如果您正苦于以下问题:C++ Sudoku::print_Board方法的具体用法?C++ Sudoku::print_Board怎么用?C++ Sudoku::print_Board使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sudoku
的用法示例。
在下文中一共展示了Sudoku::print_Board方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
system("color 4B");
// sound //
UINT wDeviceID; //a device ID so we can keep track of it once we open it.
DWORD dwReturn; //a return value..
MCI_OPEN_PARMS mciOpenParms; //Structure for the MCI_OPEN command
MCI_PLAY_PARMS mciPlayParms; //Structure for the MCI_PLAY command
mciOpenParms.lpstrDeviceType = TEXT("waveaudio");
mciOpenParms.lpstrElementName = TEXT("mortal.wav");
if (dwReturn = mciSendCommand(NULL, MCI_OPEN, MCI_OPEN_TYPE | MCI_OPEN_ELEMENT, (DWORD)(LPVOID)&mciOpenParms))
{
cout << "sound file unavailable.\n";
}
// The device opened successfully; get the device ID.
wDeviceID = mciOpenParms.wDeviceID;
if (dwReturn = mciSendCommand(wDeviceID, MCI_PLAY, 0, NULL))
{
mciSendCommand(wDeviceID, MCI_CLOSE, 0, NULL);
return (dwReturn);
}
// Establish Local variables
string master_loop = "y", inputFile;
int in_value;
// Create pointer to Sudoku Class
Sudoku *solution;
do // Start of master_loop
{
cout << "\n*===*===*===*===*===*===*===*===*===*===*===*===*===*===*" << "\n|\t\t\t\t\t\t\t|" << endl;
cout << "|\t\t\t FIGHTING \t\t|" << "\n|\t\t\t\t\t\t\t|" << endl;
cout << "| ///// // // //// ////// // // // // |" << endl;
cout << "| * // // // // / // // // // // // * |" << endl;
cout << "| ** ///// // // // / // // /// // // ** |" << endl;
cout << "| * // // // // / // // // // // // * |" << endl;
cout << "| ///// ////// //// ////// // // ////// |" << endl;
cout << "|\t\t\t\t\t\t TM \t|" << "\n|\t\t\t\t\t\t\t\|" << endl;
cout << "| * Anthony * Chad * Jason * Michael * Scott * |" << endl;
cout << "*===*===*===*===*===*===*===*===*===*===*===*===*===*===*" << endl;
// Ask the user to input the path to or a file name
cout << "\n\nYou must input a Sudoku Fighting file name: ";
// Read in user input assign the variable
cin >> inputFile;
// Attempt to open the file
fstream inFile(inputFile);
// If file can not open
if (!inFile)
{
cout << "\nHA!!!!, your puny file "<< inputFile << " is not detected. \nYou have to enter it correctly to fight. \nTry again.\n" << endl;
system("PAUSE");
system("CLS");
}
// If the file is found continue on with program
else
{
// Create new Sudoku Solution
solution = new Sudoku;
// Read data into Sudoku
while (inFile >> in_value)
{
solution->fill_board(in_value);
}
// Print inputed Sudoku puzzle
solution->print_Board();
// Pause to allow user to view inputed Sudoku puzzle
cout << "\n\nAre you ready to Fight?\n" << endl;
system("PAUSE");
// Call Sudoku Solution
solution->solve(0, 0);
// Print solved Sudoku puzzle
solution->print_Board();
// Conclusion
mciOpenParms.lpstrElementName = TEXT("flawless.wav");
cout << "\n\n\Hooozah! That's why they call me the Sudoku Fighter.\n" << endl;
do
{
// Ask user if they would like to try the program again
cout << "Would you like to fight again? (y) or (n): ";
// Read input
cin >> master_loop;
// If not valid reponse explain, and promt user to try again
//.........这里部分代码省略.........