I can suggest you that to carefully go through the following code of lines that can demonstrates you how to use the erase() function in the C++ programming as follows :
Code:
#include <iostream>
#include <vector>
using namespace std;
int main ()
{
unsigned gnt g;
vector<unsigned int> mvctr;
for (g=1; g<=10; g++) mvctr.push_back(g);
mvctr.erase (mvctr.begin()+5);
mvctr.erase (mvctr.begin(),mvctr.begin()+3);
cout << "mvctr contains:";
for (g=0; g<mvctr.size(); g++)
cout << " " << mvctr[g];
cout << endl;
return 0;
}
Output:
Code:
mvctr contains: 4 5 7 8 9 10
Bookmarks