Why I cannot move to the second vector I pushed back in the second for?? |
You
are moving to the second vector.
At lines 8 - 10, you push 3 numbers onto
row. After this, the elements of
row are:
0 1 2
You then copy
row into
f as the first element of the vector.
At lines 14 - 16, you push another 3 numbers onto
row. After this, the elements of
row are:
0 1 2 9 10 11
You then copy
row into
f as the second element of the vector. The full contents of
f are now:
0 1 2
0 1 2 9 10 11
When you print out the contents of
f, you're only printing the first 3 elements of each vector, so you get:
0 1 2
0 1 2
If you change your printing loop to:
1 2 3 4 5 6 7 8
|
for (int row = 0; row < f.size(); row++)
{
for(int col = 0; col < f[row].size(); col++)
{
std::cout << f[row][col] << " ";
}
std::cout << std::endl;
}
|
you'll see the full contents of each element of
f.