#include #include using namespace std; vector v; void outv() { for(int n : v) cout << n <<" "; cout << endl; } int main() { v = { 0, 1, 2, 3, 4}; v.pop_back(); outv(); // 0 1 2 3 v.clear(); outv(); // v = { 0, 1, 2, 3, 4}; v.erase(v.begin()+2); outv(); // 0 1 3 4 v = { 0, 1, 2, 3, 4, 5, 6, 7, 8}; v.erase(v.begin()+2, v.end()-2); outv(); // 0 1 7 8 return 0; }