stl之set
来源:互联网 发布:狐狸 知乎 编辑:程序博客网 时间:2024/04/30 04:33
#include<set>
#include<list>
#include<vector>
#include<algorithm>
#include<iostream>
#include<iterator>
using namespace std;
set<int> a, b, c;
int main()
{
set<int>::iterator it;
int i;
for(i = 1; i < 10; i++)
{
a.insert(i);
b.insert(i-5);
}
set_union(a.begin(), a.end(), b.begin(), b.end(), inserter(c, c.begin()) );
copy(c.begin(), c.end(), ostream_iterator<int>(cout, " ") );
cout << endl;
c.clear();
set_intersection(a.begin(), a.end(), b.begin(), b.end(), inserter(c, c.begin()) );
copy(c.begin(), c.end(), ostream_iterator<int>(cout, " ") );
cout << endl;
c.clear();
set_difference(a.begin(), a.end(), b.begin(), b.end(), inserter(c, c.begin()) );
copy(c.begin(), c.end(), ostream_iterator<int>(cout, " ") );
cout << endl;
c.clear();
set_symmetric_difference(a.begin(), a.end(), b.begin(), b.end(), inserter(c, c.begin()) );
copy(c.begin(), c.end(), ostream_iterator<int>(cout, " ") );
cout << endl;
c.erase(-3);
copy(c.begin(), c.end(), ostream_iterator<int>(cout, " ") );
cout << endl;
system("pause");
return 0;
}
- 【STL】STL之set
- stl之set
- STL 应用之set
- STL容器之set
- STL之<set>
- STL之set
- STL之set
- C++ STL之set
- C++ STL 之set
- STL 之 set 集合
- STL之set
- STL 之set 练习
- stl 之set图解
- STL之set姿势
- STL 之 set
- stl之set
- stl之hash set
- STL具体操作之set
- code fragment Five from
- useful web links
- 1080P,720P等高清分辨率的含义
- 郁闷..感冒了..
- SD--定价过程的16个字段的作用说明
- stl之set
- 我也开博了... ...
- Poem From Sarah
- 使用OptimizeIT进行java内存泄露的检测
- altas(ajax)控件(十一):DropShadow为某一个控件添加阴影
- 对异常处理学习的一点小节
- code fragment Six from
- OpenWFE项目分析
- 语言是客观世界的一个镜像(转)