Hint: You can edit your post, highlight your code and press the <> formatting button. This will not automatically indent your code. That part is up to you.
You can use the preview button at the bottom to see how it looks.
I found the second link to be the most help.
salem chas a good example and here is another option:
1 2 3 4 5 6 7 8
int maxRows{ 10 };
while (maxRows)
{
// Other while loops.
maxRows--;
}
This would be for the outer most for loop.
By starting the loop counter, i.e., (maxRows), at 10 and subtracting each time through the loop when you reach (0)zero this is considered "false" and the while condition fails.
For your for loops C++ is zero based and you for loops would normally start at (0)zero. If you get use to using (<=) in the condition eventually your for loop will have to start at (0)zero and the (<=) will loop 1 more time than you want meaning that you would be going past the end of an array, vector, or list or some other container which usually causes the program to crash.
Just as an example this is your code made more readable: