Vector-Erase

  • + 0 comments

    include

    include

    include

    include

    include

    using namespace std;

    int main() { int N; cin>>N;//taking the size of vector vectorv; int i; //giving elements to the vector for (i=0; i>e; v.push_back(e); } int x; cin>>x; //erasing the vector v.erase(v.begin()+(x-1)); int a,b; cin>>a; cin>>b; //position deleting v.erase(v.begin()+(a-1),v.begin()+(b-1)); vector::iterator it; int count=0; for (it=v.begin(); it