#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(void)
{
int i,a[10],b;
for(i=0; i<10; i++){
scanf("%d",&a[i]);
}
scanf("%d",&b);//插入的数
{
vector<int> V;
for(i = 0; i < 10; i++)
V.insert(V.begin() + i, a[i]);
V.insert(V.begin(), b);
for(i = 0; i < 11; i++)
cout << "[" << V[i] << "]";
cout << endl;
sort(V.begin(), V.end());
V.erase(V.begin() + 10);
// for(i = 0; i < 10; i++)
// cout << "[" << V[i] << "]";
vector<int>::iterator it = V.begin();
for(; it != V.end(); it++)
cout << "[" << *it << "]";
V.clear();
}
return 0;
}
标签:CPP0039,10,begin,cout,++,pta,int,vector From: https://www.cnblogs.com/atrue/p/17416429.html