/*set意为集合,是一个内部自动排序不含重复元素的容器*/

#include<stdio.h>
#include<set>
using namespace std;
int main(){
set<int> st;
st.insert(3);
st.insert(3);
st.insert(2);
st.insert(5);
//此处不支持it<st.end()这种写法,因为set不支持*(it+i)的访问方式,set只能通过迭代器访问 
for (set<int>::iterator it = st.begin(); it != st.end(); it++){
printf("%d", *it);
}
}

 

输出结果如下:

235

posted on 2016-10-16 11:50  Google-boy  阅读(237)  评论(0)    收藏  举报