使用find函数确定数据的出现位置,然后返回的迭代器是
显示数据时,返回数据所在的迭代器。 如果map中没有要搜索的数据,则返回与end函数返回的迭代器相同的迭代器
#包含地图
#包含字符串
#include iostream
用户命名空间STD;
Int main () )
{
映射输入,字符串映射脚本;
mapstudent.insert(pairint,string(1,“student_one”);
mapstudent.insert(pairint,string(2,“student_two”);
mapstudent.insert(pairint,string(3,“student_three”);
mapint,string :3360迭代器;
iter=mapstudent.find(1;
if(ITER!=mapStudent.end ()
{
Cout”Find,the value is ”iter-secondendl;
}
Else
{
Cout”Do not Find”endl;
}
}
3359 blog.csdn.net/QQ _ 33573235/article/details/80277424