We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- STL
- Vector-Erase
- Discussions
Vector-Erase
Vector-Erase
Sort by
recency
|
412 Discussions
|
Please Login in order to post a comment
// Can anyone help to find out the mistake
include
include
include
include
include
using namespace std;
int main() { vector v; int n,value; cin>>n; for(int i=0;i>value; v.push_back(value); } v.erase(v.begin()+1); v.erase(v.begin()+1,v.begin()+3);
}
all test case clear
Earasing the vectors using the C++ language
Code solution :
include
include
include
include
include
using namespace std;
int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ vectorv; int n,x; cin>>n; for(int i = 0; i>x; v.push_back(x); } int y; cin>>y; v.erase(v.begin()+y-1); int z,a; cin>>z>>a; v.erase(v.begin()+(z-1), v.begin()+(a-1));
}