Create Vector-Erase.cpp

pull/903/head
Vicky 2022-10-03 11:10:30 +05:30 committed by GitHub
parent 92066cdb6a
commit 5ed96203ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,28 @@
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int size,pos,start,end,n,i,a,j;
cin>>n;
vector<int>v;
for(i=0;i<n;i++)
{
cin>>a;
v.push_back(a);
}
cin>>pos>>start>>end;
v.erase(v.begin()+(pos-1));
v.erase(v.begin()+start-1,v.begin()+end-1);
size=v.size();
cout<<size<<endl;
for(j=0;j<size;j++)
{
cout<<v[j]<<" ";
}
return 0;
}