delete from front in vector c++
#include <iostream>
#include <vector>
int main() {
std::vector<int> myVector = {1, 2, 3, 4, 5};
// Step 1: Check if the vector is not empty
if (!myVector.empty()) {
// Step 2: Use the erase() function to delete the element at the front
myVector.erase(myVector.begin());
// Step 3: Print the modified vector
std::cout << "Modified Vector: ";
for (const auto& element : myVector) {
std::cout << element << " ";
}
} else {
std::cout << "Vector is empty.";
}
return 0;
}