Ok, I'm just learning C++ by use of a book called You Can Do It, A Beginners Intro to Comp Programming. I'm on Chapter 2, and have just learned the for-loop. At the end, there are these exercises to do. The last one requires you to display all 256 colors on an object call paper that is specific to the compiler that came with the book.
Now, the book provided the following code for the exercise:
It works, displaying all of the colors on the paper object. The confusion is how it works. Looking at it, I don't understand how this would ever plot all 256 colors in a perfect sqaure on the screen.Code:for(int i(0); i != 16; ++i){ for(int c(0); c != 16; ++c){ paper.plot(c - 8, i - 8, (i * 16 + c)); } }
Can somebody help me out? And feel free to ask questions if you don't understand what the code is about or what I'm asking or anything else.