// 2 dimensional array, with function for picture and recursive print #include using namespace std; void changeState(bool picture[][21], int indent, int rows, int cols) { for (int r = indent; r <= rows -1 - indent; r++) for (int c = indent; c <= cols - 1 - indent; c++) picture[r][c] = !picture[r][c]; } void print(bool picture[][21], int rows, int cols) { if (rows > 1) print(picture, rows - 1, cols); for (int c = 0; c < cols; c++) if (picture[rows - 1][c]) cout << "*"; else cout << " "; cout << endl; } int main() { bool picture[21][21]; for (int r = 0; r <= 20; r++) for (int c = 0; c <= 20; c++) picture[r][c] = true; for (int indent = 1; indent <= 10; indent++) changeState(picture, indent, 21, 21); print(picture, 21, 21); return 0; }