How can a parameter be removed from a vector?

To delete an element in a vector, you can use the erase() function. This function takes two parameters: the first parameter is the iterator of the element to be deleted, and the second parameter is the iterator of the next element to be deleted.

Here is an example code:

#include <iostream>
#include <vector>

int main() {
    std::vector<int> vec = {1, 2, 3, 4, 5};

    // 删除第三个元素
    vec.erase(vec.begin() + 2);

    // 打印剩余的元素
    for (int num : vec) {
        std::cout << num << " ";
    }

    return 0;
}

The output is: 1 2 4 5

In the example above, we used the erase() function to delete the third element in the vector. To delete elements at other positions, simply pass the iterator of the element to be deleted to the erase() function.

bannerAds