1.
//逆时针遍历 void test02() { vector<int>v; for (int i = 0; i < 10; i++) { v.push_back(i); } printVector(v); //逆序迭代器 reverse_iterator for (vector<int>::reverse_iterator it=v.rbegin(); it!=v.rend(); it++) { cout << *it << " "; } cout << endl; }
结果: