Have you read the PPP and especially that chapter?
Perhaps you could either provide the block of code in question or a link to it, if it is available online.
Thinking logically, you could have a function to draw a coloured square at the required screen coordinates. Then you just need to iterate through a matrix calling the function with the x and y coordinates for where the square is to be drawn, the size of a square side, and colour.
I have a hard time believing you weren't introduced to containers of some sort by the time you hit that point in the book, although I can well believe you weren't introduced to the the deque.
You may treat it almost the same as a vector, although it avoids a problem in this code that a vector would not. (Mainly that a push_back may cause reallocation and therefore relocation of elements so that the address fed to win.attach() is no longer valid.)
I have a hard time believing you weren't introduced to containers of some sort by the time you hit that point in the book
Yeah, I weren't introduced to that facility until now in this book!
When I recalled the vectors I immediately thought about some code like below:
1 2 3 4 5 6 7 8 9 10 11 12 13
Simple_window win(t, 600,400, "My window");
// some more codes.