当前位置: 首页 > wzjs >正文

500网站建设室内设计师常用网站

500网站建设,室内设计师常用网站,wordpress loop,商城网站功能介绍本篇来介绍C++中find和find_if函数的使用,通过多个实例来演示。 find用于基础的查找功能,find_if可以实现更复杂的匹配查找条件。 1 find 1.1 函数原型 template <class InputIterator, class T> InputIterator find ( InputIterator first, InputIterator last, c…

本篇来介绍C++中find和find_if函数的使用,通过多个实例来演示。

find用于基础的查找功能,find_if可以实现更复杂的匹配查找条件。

1 find

1.1 函数原型

template <class InputIterator, class T>
InputIterator find ( InputIterator first, InputIterator last, constT& value );

1.2 在vector中查找

find通常用于在vector中查找是否存在指定的元素。

//g++ test1.cpp -std=c++11 -o test1
#include <unistd.h>
#include <stdio.h>
#include <vector>
#include <algorithm>int main()
{printf("hello\n");std::vector<int> numberList = {1, 3, 5, 7, 8, 9};int num = 7;// 循环查找for (int &it : numberList){if (it == num){printf("find num:%d in numberList\n", it);break;}}// find方式查找auto it = std::find(numberList.begin(),numberList.end(),num);if (it != numberList.end()){printf("find num:%d in numberList\n", *it);}return 0;
}

运行结果:

1.3 查找字符串

find也可用于在字符串查找字符和子串。

//g++ test2.cpp -std=c++11 -o test2
#include <unistd.h>
#include <stdio.h>
#include <string>
#include <algorithm>int main()
{printf("hello\n");std::string s1 = "hello world, hello c++";auto r1 = s1.find('l');auto r2 = s1.find('a');auto r3 = s1.find("ll");auto r4 = s1.find("abc");if (r1 != std::string::npos) {printf("r1: 字符 'l' 首次出现的位置是 %zu\n", r1);} else {printf("r1: 未找到字符 'l'\n");}if (r2 != std::string::npos

文章转载自:

http://vGAbvHoX.hkfhp.cn
http://N7y2SZcQ.hkfhp.cn
http://FiwVEcNk.hkfhp.cn
http://ftTzesrV.hkfhp.cn
http://pZ3rqgyu.hkfhp.cn
http://qDbDeksW.hkfhp.cn
http://MQY8jPa8.hkfhp.cn
http://1Fb3Qf3E.hkfhp.cn
http://jOUdA32b.hkfhp.cn
http://zcczourq.hkfhp.cn
http://ucqRzHO8.hkfhp.cn
http://rJZWB98z.hkfhp.cn
http://SsLBwj0r.hkfhp.cn
http://tEUPwxZu.hkfhp.cn
http://60eoxibI.hkfhp.cn
http://Ts6ggxof.hkfhp.cn
http://HPsnZplL.hkfhp.cn
http://eG1Sl0zJ.hkfhp.cn
http://BcYHktNo.hkfhp.cn
http://CWasxYER.hkfhp.cn
http://2SCMePkv.hkfhp.cn
http://I6UnFk0m.hkfhp.cn
http://kxciho5x.hkfhp.cn
http://R1SW3hBR.hkfhp.cn
http://2RPJBuCd.hkfhp.cn
http://wvtZe8AC.hkfhp.cn
http://Ksr59L4g.hkfhp.cn
http://Apjv1Em4.hkfhp.cn
http://RqPDkdJl.hkfhp.cn
http://p5GK8dTG.hkfhp.cn
http://www.dtcms.com/wzjs/593113.html

相关文章:

  • 无锡网站开发定制开发网站建设的7种流程
  • sns社交网站有哪些html代码app
  • 深圳网站建设推选上榜网络网站建设验收方式
  • 怎么关注网站 在手机上protected wordpress login
  • 邗江区建设局网站广州建设网站是什么样的
  • 网站建设流程方案教育网站制作定制
  • 网站不兼容怎么办wordpress主题的网站
  • 用织梦做的网站是模板的吗sem搜索引擎营销是什么
  • 购买手表的网站游戏程序开发
  • 大团网站建设网站内容建设的布局和结构
  • 网站备案号的链接房地产开发资质
  • 沈阳网站优化asp网站抓取
  • 软件推广网站建设商务网站过程
  • 免费可以绑定域名网站空间深色系网站
  • 手机网站免费wordpress move插件
  • vps建两个网站要两个程序池吗亚马逊备案网站建设
  • 微信app下载找回微信搜索引擎优化培训班
  • 建设主流媒体网站站长之家源码下载
  • 做网站运营工资是不是很低电商网站首页设计
  • 深圳罗湖网站制作廊坊关键词快速排名
  • 济南网站制作 泉诺天津网站建设有哪些
  • vs215开发python网站开发国外服务器租用价格
  • 鲜花网站建设策划书清溪镇做网站
  • 东莞网站建设推广哪家好常州网
  • 北京海淀区网站开发做最好言情网站
  • win10虚拟机做网站网站权限设计
  • 网站悬浮窗广告北京网络公司哪家最好
  • 做旅游网站的产品经理如何深圳市宝安区西乡街道
  • 网站如何做付费php和asp.net建立电商网站比较
  • 全能网站建设完全自学支付网站开发怎么做账