当前位置: 首页>>代码示例>>C++>>正文


C++ Sudoku::print_Board方法代码示例

本文整理汇总了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
//.........这里部分代码省略.........
开发者ID:rukeyscott,项目名称:Sudoku_fighter,代码行数:101,代码来源:Source.cpp


注:本文中的Sudoku::print_Board方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。