find算法函数查找示例

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/u012787116/article/details/72824011
#include <iostream>
#include <list>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	list<string> strList;
	
	strList.push_back("nihao");
	strList.push_back("dajiahao");
	strList.push_front("beijing");
	strList.push_front("shanghai");

	list<string>::iterator iterStrList;
	iterStrList = find(strList.begin(), strList.end(), "shanghai");
	cout << *iterStrList << endl;

	system("pause");
	return 0;
}

展开阅读全文

没有更多推荐了,返回首页