C this is the text of sudokutxt you can load from and this i
C++
this is the text of sudoku.txt you can load from:
and this is the cpp provided:
Solution
#include <iostream>
#include <cstdlib>
using namespace std;
//class
class Sudoku {
private:
public:
int value;
ofstream Numbers;
Numbers.open(\"sudoku.txt\");
Numbers >> value;
void Print(char game[0][9]){
cout << \"\\t+---+---+---+---+---+---+---+---+---+\" << endl;
for (int a=0; a<9; a++) {
cout << \"\\t| \";
for (int b=0; b<9; b++)
cout << game[a][b] << \" | \";
cout << endl;
cout << \"\\t+---+---+---+---+---+---+---+---+---+\" << endl;
}
}
void generation(char game[9][9]) //generation function with arg
{
int randV;
int r,c;
for(int a=0;a<81;a++)
{
for( r=0;r<9;r++)
{
for(c=0;c<9;c++)
{
randV=(rand()%9)+1;
if(game[r][c]==0)
{
game[r][c]=randV;
if(!isLegal()) //check for invalid then
{
game[r][c]=0; //make sqr=0;
}
}
}
}
}
}
};
void MakeMove(char game[][9], int, int, char);
int main ( ) {
char game[9][9];
for (int a=0; a<9; a++) // initialize board
for (int b=0; b<9; b++)
game[a][b] = \' \';
int done = 0, count = 0, row, col, num;
while ( done == 0 ) {
if (count%2 == 0) {
cout << \"Enter a number (r,c,n): \";
cin >> row >> col >> num;
MakeMove (game, row, col, num); }
//else {
// cout << \"Enter move (r c) for O : \";
// cin >> row >> col;
// MakeMove (game, row, col, \'O\'); }
//done = CheckWinner (game);
//PrintBoard (game);
Print (game);
count++;
}
if (done == 1)
cout << \"Winner\" << endl;
else if (done == 2)
cout << \"Winner\" << endl;
else // done == 3
cout << \"Tie – cat’s game\" << endl;
return 0;
}
void MakeMove (char game[ ][3], int r, int c, char ch) {
if (game[r][c] == \' \')
game[r][c] = ch;
else
cout << \"Illegal move, turn is lost!\" << endl;
}


