words.insert(words.begin()+3,“插入”); //插入到了words动态数组的第三个元素之后
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int main() {
string s[7] = {"aa","bb","cc","dd","ee","ff","gg"};
vector<string> words(s,s+7);
cout << "还未插入元素!";
for(auto w:words){
cout << w<<" " ;
}
words.insert(words.begin()+3,"插入"); //插入到了words动态数组的第三个元素之后
cout << endl << "插入元素之后!" ;
for(auto w:words){
cout << w<<" " ;
}
return 0;
}