c++ 中map 的find 用法t186•2022-6-12•C•阅读13 用find函数来定位数据出现位置,它返回的一个迭代器,当数据出现时,它返回数据所在位置的迭代器,如果map中没有要查找的数据,它返回的迭代器等于end函数返回的迭代器, 程序演示 #include #include #include Using namespace std; Int main() { Map mapStudent; mapStudent.insert(pair(1, “student_one”)); mapStudent.insert(pair(2, “student_two”)); mapStudent.insert(pair(3, “student_three”)); map::iterator iter; iter = mapStudent.find(1); if(iter != mapStudent.end()) { Cout<<”Find, the value is ”<second< 欢迎分享,转载请注明来源:内存溢出原文地址:https://54852.com/langs/1330131.html赞 (0)打赏 微信扫一扫 支付宝扫一扫 t186一级用户组00 生成海报 C++数据结构——二叉树上一篇 2022-06-12【C语言】如果要在八进制和十六进制前显示0和0x的前缀 下一篇2022-06-12 发表评论 请登录后评论... 登录后才能评论 提交评论列表(0条)
评论列表(0条)