I've scratched my head at code for a lot longer than two hours, don't sweat it.
Okay. Nested loops. I'm going to rewrite then comment, so my comments don't get in the way here.
for (int i=0; i < 10; ++i)
std::cout << i;
for (int j=0; j < 10; ++j)
std::cout << "\t" << i * j;
std::cout << std::endl;
Line 1) Essentially prints vertically, not horizontally. It's effectively writing the 0-9 in the first column.
Line 7) This is printing out the row for our current column.
Think about how it works. If i is 0, we're going to print a zero. Then we're going to go into the inner loop, printing j * 0 separated by tabs. Then we do a newline.
Then i is 1. We print our 1, go into our nested loop, do j * 1 tab separated. Then a newline. And so on and so forth.
I think maybe you confused yourself by thinking it was building the rows and columns in different ways.
Hope this helps.