1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 5 6 void test() 7 { 8 vector<vector<int>>v; 9 vector<int> v1; 10 vector<int> v2; 11 vector<int> v3; 12 vector<int> v4; 13 for (int i = 0; i < 4; i++) 14 { 15 v1.push_back(i + 1); 16 v2.push_back(i + 2); 17 v3.push_back(i + 3); 18 v4.push_back(i + 4); 19 } 20 v.push_back(v1); 21 v.push_back(v2); 22 v.push_back(v3); 23 v.push_back(v4); 24 for (vector<vector<int>>::iterator it = v.begin(); it != v.end(); it++) 25 { 26 for (vector<int>::iterator vit = (*it).begin(); vit != (*it).end(); vit++) 27 { 28 cout << *vit << " "; 29 } 30 cout << endl; 31 } 32 } 33 34 int main() { 35 test(); 36 return 0; 37 }
标签:27,stl,back,v3,vector,vit,push,打卡 From: https://www.cnblogs.com/wlxdaydayup/p/17360262.html