Ok so i got part of my code written out but i dont understand how to go about checking all the numbers to see if it is a valid soduku code. i need a function to check the puzzle and make sure it is correct and if it is not then the errors and locations will be displayed. thank you for any help your willing to give me.
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <iomanip>
using namespace std;
void readAPuzzle(int grid[] [9]);
void printGrid(int grid[] [9]);
int main()
{
int grid[9] [9];
readAPuzzle(grid);
printGrid(grid);
system("pause");
return 0;
}
void readAPuzzle(int grid[] [9])
{
ifstream in_f;
in_f.open("soduku.txt");
for (int i = 0; i < 9; i++)
for (int j = 0; j < 9; j++)
in_f >> grid[i] [j];
}
//Prints out the puzzle read from file (keep)
void printGrid(int grid[] [9])
{
cout<<"Your Puzzle Is Listed Below: "<<endl;
for (int i = 0; i < 9; i++)
{
if ((i)%3 == 0)
cout<<endl<<endl;
for (int j = 0; j < 9; j++)
{
cout << (grid[i] [j]) << " ";
if ((j+1)%3 == 0)
cout<<" ";
}
cout<<endl;
}
cout<<endl;
}
// CHECK IF VALID PUZZLE