for (y=0; y<9; y++){
if (y%3==0)
cout<<"------------------...";
for (x=0; x<9; x++){
if (x%3==0)
cout<<"|";
if (x%3!=0)
cout<<" ";
cout<<sudokuBoard[x][y];
}
cout<<endl;
}
void display(char sudokuBoard[][9])
{
//Declare variables
char option;
//Display Column Header
cout << " A B C D E F G H I" << endl;
for (int y = 0; y<9; y++)
{
if (y==3 || y==6)
cout<<"-----+-----+-----\n";
for (int x = 0; x<9; x++)
{
if (x==3 || x==6)
cout<<"|";
if (x!=3 || x!=6)
cout<<" ";
cout<<sudokuBoard[x][y];
}
cout << endl;
}
it looks like this right now.
Where is your board located? mygame.txt
Options:
? Show these instructions
D Display the board
E Edit one square
S Show the possible values for a square
Q Save and Quit
A B C D E F G H I
7 2 3| | 1 5 9
6 | 3 2| 8
8 | 1 | 2
-----+-----+-----
7 | 6 5 4| 2
4| 2 7| 3
5 | 9 3 1| 4
-----+-----+-----
5 | 7 | 3
4 | 1 3| 6
9 3 2| | 7 1 4
im trying to get it to look like this
A B C D E F G H I
1 7 2 3| |1 5 9
2 6 |3 2| 8
3 8 | 1 | 2
-----+-----+-----
4 7 |6 5 4| 2
5 4|2 7|3
6 5 |9 3 1| 4
-----+-----+-----
7 5 | 7 | 3
8 4 |1 3| 6
9 9 3 2| |7 1 4
hmmmm..and after posting in here I noticed some of the spacing is off.
void display(char sudokuBoard[][9])
{
//Declare variables
char option;
//Display Column Header
cout << " A B C D E F G H I" << endl;
for (int y = 0; y<9; y++)
{
cout << y << " ";
if (y==3 || y==6)
cout<<"-----+-----+-----\n";
for (int x = 0; x<9; x++)
{
if (x==3 || x==6)
cout<<"|";
if (x%3)
cout<<" ";
cout<<sudokuBoard[x][y];
}
cout << endl;
}
A B C D E F G H I
0 7 2 3| |1 5 9
1 6 |3 2| 8
2 8 | 1 | 2
3 -----+-----+-----
7 |6 5 4| 2
4 4|2 7|3
5 5 |9 3 1| 4
6 -----+-----+-----
5 | 7 | 3
7 4 |1 3| 6
8 9 3 2| |7 1 4
>
void display(char sudokuBoard[][9])
{
//Declare variables
char option;
//Display Column Header
cout << " A B C D E F G H I" << endl;
for (int y = 0; y<9; y++)
{
if (y==3 || y==6)
cout<<" -----+-----+-----\n";
cout << y+1 << " ";
for (int x = 0; x<9; x++)
{
if (x==3 || x==6)
cout<<"|";
cout<<sudokuBoard[x][y];
}
cout << endl;
}