头文件 ;#include <set>

简单应用:

begin()        返回set容器的第一个元素

end()       返回set容器的最后一个元素

clear()          删除set容器中的所有的元素

empty()      判断set容器是否为空

max_size()     返回set容器可能包含的元素最大个数

size()       返回当前set容器中的元素个数

find()

   set<int>a;

   set<int>::iterator it;

   int p;
        if((it=a.find(p))!=a.end())
            cout<<"yes"<<endl;

注意:

set里面的元素自动排序,set会自动删除重复

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-04-16
  • 2022-12-23
  • 2022-01-08
  • 2021-06-06
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-23
  • 2021-09-30
  • 2021-09-02
  • 2021-12-04
  • 2021-09-08
  • 2022-02-22
  • 2022-02-22
相关资源
相似解决方案