// example from https://en.cppreference.com/w/cpp/container/vector/resize // #include #include // added this and removed std:: throughout, RP: // using namespace std; int main() { vector c = {1, 2, 3}; cout << "The vector holds: "; for(auto& el: c) cout << el << ' '; cout << '\n'; c.resize(5); cout << "After resize up to 5: "; for(auto& el: c) cout << el << ' '; cout << '\n'; c.resize(2); cout << "After resize down to 2: "; for(auto& el: c) cout << el << ' '; cout << '\n'; }