cpp vector2
- Declare the vector: Initialize a vector named "vec" with data type int.
- Add elements to the vector: Use the push_back() method to add elements 5, 10, and 15 to the vector.
- Access elements by index: Retrieve and print the first element of the vector using vec[0].
- Iterate through the vector: Use a for loop to iterate through the elements of the vector and print each element.
- Remove elements from the vector: Use the pop_back() method to remove the last element from the vector.
- Check if the vector is empty: Use the empty() method to check if the vector is empty and print the result.