but now i have a new problem.
int main() {
int main[9][9] = {
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0}
};
bool edit[9][9] = {
{true,true,true,true,true,true,true,true,true},
{true,true,true,true,true,true,true,true,true},
{true,true,true,true,true,true,true,true,true},
{true,true,true,true,true,true,true,true,true},
{true,true,true,true,true,true,true,true,true},
{true,true,true,true,true,true,true,true,true},
{true,true,true,true,true,true,true,true,true},
{true,true,true,true,true,true,true,true,true},
{true,true,true,true,true,true,true,true,true}
};
cout << "|*|0 |1 |2 ||3 |4 |5 ||6 |7 |8 |" << endl;
cout << "+-+--+--+--++--+--+--++--+--+--+" << endl << "|0|";
for (int iCol = 0; iCol < 9; ++iCol) {
for (int iRow = 0; iRow < 9; ++iRow) {
cout << main[iCol][iRow];
if (edit[iCol][iRow] == true) {
cout << " |";
} else {
cout << "!|";
}
if (iRow == 2 || iRow == 5) {
cout << "|";
}
}
cout << endl << "+-+--+--+--++--+--+--++--+--+--+" << endl;
if (iCol == 2) {
cout << "+-+--+--+--++--+--+--++--+--+--+" << endl;
}
if (iCol == 5) {
cout << "+-+--+--+--++--+--+--++--+--+--+" << endl;
}
cout << "|" << iCol + 1 << "|";
}
output:
|*|0 |1 |2 ||3 |4 |5 ||6 |7 |8 |
+-+--+--+--++--+--+--++--+--+--+
|0|0 |0 |0 ||0 |0 |0 ||0 |0 |0 |
+-+--+--+--++--+--+--++--+--+--+
|1|0 |0 |0 ||0 |0 |0 ||0 |0 |0 |
+-+--+--+--++--+--+--++--+--+--+
|2|0 |0 |0 ||0 |0 |0 ||0 |0 |0 |
+-+--+--+--++--+--+--++--+--+--+
+-+--+--+--++--+--+--++--+--+--+
|3|0 |0 |0 ||0 |0 |0 ||0 |0 |0 |
+-+--+--+--++--+--+--++--+--+--+
|4|0 |0 |0 ||0 |0 |0 ||0 |0 |0 |
+-+--+--+--++--+--+--++--+--+--+
|5|0 |0 |0 ||0 |0 |0 ||0 |0 |0 |
+-+--+--+--++--+--+--++--+--+--+
+-+--+--+--++--+--+--++--+--+--+
|6|0 |0 |0 ||0 |0 |0 ||0 |0 |0 |
+-+--+--+--++--+--+--++--+--+--+
|7|0 |0 |0 ||0 |0 |0 ||0 |0 |0 |
+-+--+--+--++--+--+--++--+--+--+
|8|0 |0 |0 ||0 |0 |0 ||0 |0 |0 |
+-+--+--+--++--+--+--++--+--+--+
|9|
how do you get rid of the |9| at the end and keep the for loop?