#include using namespace std; int main() { vector v1; v1.push_back(5); v1.push_back(10); v1.push_back(3); v1.push_back(1); cout << "Vector size: " << v1.size() << endl << endl; /* Pre-C++11 / C++0x */ for (vector::iterator i = v1.begin(); i < v1.end(); i++) cout << *i << endl; cout << endl; /* C++11 */ for (auto i = v1.begin(); i < v1.end(); i++) cout << *i << endl; cout << endl; /* C++11 “for each” */ for (int i : v1) cout << i << endl; cout << endl; /* C++11 */ vector v2 {5, 10, 3, 1, 20}; if (v1 == v2) cout << "Vectors are equal" << endl; else cout << "Vectors are not equal" << endl; v2.pop_back(); if (v1 == v2) cout << "Vectors are equal" << endl; else cout << "Vectors are not equal" << endl; /* #include */ sort(v1.begin(), v1.end()); vector > vt; sort(vt.begin(), vt.end());