Basic question about vector.

This is the question:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include<iostream>
#include<iomanip>
#include<vector>

using namespace std;

void fn(vector<vector<int> > &v){
	for (int i = 0; i < v.size(); i++){
		cout << v[i].size() << " ";
		for (int j = 0; j < v[i].size(); j++)
			cout << ++v[i][j] << " ";
		cout << endl;
	}
}
int main(){
	vector<int> v1(4, 8);
	vector<int> w1(3, 7);
	vector<vector<int>> v2(2, v1);
	v2.push_back(w1);
	v2[0].push_back(1);
	fn(v2);
	system("pause");
}

ANSWER:
1
2
3
   599992
          49999
          3888


I just don't understand why it has 5, 4, 3 respectively in front. For me, the answer should be:
1
2
3
99992
9999
888

line 9 is printing the 5,4,3

cout << v[i].size() << " ";

Thanks wildblue, I understand it now :)
Topic archived. No new replies allowed.