#include #include using namespace std; int main() { const size_t ncols = 3; char a[][ncols] = { //can omit only the leftmost dimension {'O', 'O', 'X'}, //curly braces optional on this line {'X', 'X', 'X'}, {'O', ' ', 'O'} }; const size_t nrows = sizeof a / sizeof a[0]; /* Each subscript has its own pair of square brackets. The first subscript is the row number. The second subscript is the column number. */ cout << a[0][0] << a[0][1] << a[0][2] << "\n" //top row is row 0 << a[1][0] << a[1][1] << a[1][2] << "\n" //middle row is row 1 << a[2][0] << a[2][1] << a[2][2] << "\n\n";//bottom row is row 2 for (size_t row = 0; row < nrows; ++row) { for (size_t col = 0; col < ncols; ++col) { cout << a[row][col]; } cout << "\n"; } return EXIT_SUCCESS; }