Hello, I am attempting to make a Sudoku solver, and i am having issues getting the grid to display, i have the values saved as a [9][9] array, and i am trying to get them to display using a nested for loop that should go through each group and display them, but it wont display them, the program does compile and run without any errors.
here is the code for the display
1 2 3 4 5 6 7 8 9 10 11
void drawGrid()
{
for (int f = 0; f > 9; f++)
{
for (int g = 0; g > 9; g++)
{
cout << grid[g][f] << " ";
}
cout << "\n";
}
}
#include <iostream>
#include <windows.h>
usingnamespace std;
int grid[9][9];
void drawGrid();
void defGrid();
int main()
{
defGrid();
int x, y;
int a;
cout << "Hello, lets solve a sudoku shall we?" << endl;
do
{
drawGrid();
cout << "Enter the grid coords x,y then the number 1-9, or enter 0 0 0 to begin solving" << endl;
cin >> x;
cin >> y;
cin >> a;
x = x - 1;
y = y - 1;
if (x > 9 || x < 0)
{
x = 0;
}
if (y > 9 || y < 0)
{
y = 0;
}
if (a > 9 || a < 1)
{
a = 0;
}
grid[x][y] = a;
system("cls");
}
while(a != 0);
do
{
cout << "Please select an option." << endl;
cout << "1 : Run the Row Checker" << endl;
cout << "2 : Run the Column Checker" << endl;
cout << "3 : Run the Area Checker" << endl;
cout << "4 : Exit" << endl;
cin >> a;
system("cls");
switch (a)
{
case 1:
break;
case 2:
break;
case 3:
break;
case 4:
cout << "Good Bye." << endl;
return 0;
break;
}
}
while(true);
}
void defGrid()
{
for (int y = 0; y > 9; y++)
{
for (int x = 0; x > 9; x++)
{
grid[x][y] = 0;
}
}
}
i moved the display to top section for easier viewing.