--------------------------------------------------------------------------------
im trying to create a program that will open a file and read it, then check to see if it is a solution for a sudoku puzzle. so far i have....
Code:
fstream infile;
infile.open ( "good.txt", ifstream::in );
if ( infile.is_open() == false ) {
cout << "couldn't open " << endl;
}
int i;
int k;
int a [9] [9];
for (int i=0; i<9; i++)
{
for (int k=0; k<9; k++)
{
if (a[i][k]==k+1)
{
cout << "solved" << endl;
}
if(a[i][k]!=k+1)
{
cout<<"row "<<i<<" is missing "<<k+1<<endl;
}
}
}
return 0;
}
my problem is that it doesnt diplay what it should. its like it isnt opening the file or reading it.
am i missing something?
also...im not sure how to have it check for a solution in a 3x3 square...any suggestionS?