Nested ForLoop Help

Hello. First post as a very newbie to C++ programming.
I've been working through the exercises in the C++ for dummies book version 3 and got to nested ForLoops and hit a brain block!
Here is the code and the output i get when i run it in my compiler.
I understand the "products of" output but where do the first set of numbers come from in the output file?

Thank you in advance for anyone who helps me understand this! i'm reluctant to move on to any other exercises before i understand this one, the next one in the book has a break in it and thats melting my brain too :)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>

using namespace std;

int main()
{
    int x,y;

    for (x = 1; x <= 10; x++)
    {
        cout << "Products of " << x <<endl;
        for (y = 1; y <= 10; y++)
        {
            cout << x * y << endl;
        }
        cout << endl;
    }

    return 0;
}


OUTPUT displayed when run is:
27
36
45
63
72
81
90
Products of 10
10
20
30
40
50
60
70
80
90
100





The output is scrolling off the screen. What you see there is the end of the "Products of 9" section, followed by the "Products of 10" section.
OH! now i feel very silly!
When you see the whole output it makes sense!
Thank you
Topic archived. No new replies allowed.