C++ Vector Operation Delete Elements
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> num{1, 2, 3, 4, 5};
// initial vector
cout << "Initial Vector: ";
for (int i : num) {
cout << i << " ";
}
// remove the last element
num.pop_back();
// final vector
cout << "\nUpdated Vector: ";
for (int i : num) {
cout << i << " ";
}
return 0;
}