各种遍历方式,依次递进。
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
vector<vector<int>> res = {{1,2,3}, {4,5,6},{7,8,9},{10,11,12}};
vector<int> temp_vect;
for(vector<int>::iterator ite= res.begin();ite!= res.end();++ite) {
temp_vect = *ite;
for(vector<int>::iterator it= temp_vect.begin();it!= temp_vect.end();it++) {
cout <<*it<<" ";
}
cout << endl;
}
}
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
vector<vector<int>> res = {{1,2,3}, {4,5,6},{7,8,9},{10,11,12}};
for(vector<int>temp:res) {
for(int i:temp) {
cout << i<<" ";
}
cout<<endl;
}
return 0;
}
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char** argv) {
vector<vector<int>> res = {{1,2,3}, {4,5,6},{7,8,9},{10,11,12}};
for(auto temp:res) {
for(auto i:temp) {
cout << i<<" ";
}
cout<<endl;
}
return 0;
}