#include <list>
#include <iostream>
#include <algorithm>//注意需要这个库
using namespace std;
int main()
{
list<int> l;
for(size_t i=1; i < 11; ++i)
{
l.push_back(i);
}
list<int>::iterator it;
for (it=l.begin(); it!=l.end();++it)
{
cout << *it << ” “;
}
cout <<endl;
//采用find()查找算法在链表中查找;
it = find(l.begin(),l.end(),5);
if (it != l.end())
{
cout << “find it” << endl;
}
else
{
cout << “not find it” << endl;
}
cin.get();
return 0;
}