您的位置:首页 > 其它

set集中查找find

2016-03-03 21:11 267 查看
#include <iostream>
#include <set>

using namespace std;

typedef set<int> SETINT; // SETINT是别名,
int main()
{
SETINT a;
a.insert(67);
a.insert(7);
a.insert(-2);

SETINT::const_iterator i;
for (i = a.begin(); i != a.end(); ++i)
{
cout << *i << endl;
}
SETINT::iterator i_found = a.find(70);
if (i_found != a.end())
cout << "找到了," << *i_found << endl;
else
cout << "没有找到," << endl;

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: