Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- vect.push_back("Hello");
- vect.push_back("Hi");
- vect.push_back("Rasmi");
- for(vect<string>::iterator it = vect.begin(); it != vect.end(); ++it)
- {
- if(*it == "Rasmi") // If it encounters "Rasmi"
- {
- //it--;
- int index = it - vect.begin ();
- vect.insert(vect.begin()+2, "Hi");
- it = vect.begin () + index;
- }
- cout << *it;
- }
- Hello->Hi->Rasmi... The execution becomes successful.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement