#include <iostream>
#include <list>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
list<int> ilst;
cout << "Enter some numbers:" << endl;
int val;
while (cin >> val) {
ilst.push_back(val);
}
vector<int> ivec;
ilst.sort();
unique_copy(ilst.begin(), ilst.end(), back_inserter(ivec));
for (vector<int>::iterator it = ivec.begin(); it != ivec.end(); ++it)
{
cout << *it << " ";
}
cout << endl;
getchar();
return 0;
}
STL unique_copy demo
最新推荐文章于 2023-02-01 11:42:36 发布