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

做app网站的软件有哪些软件开发培训视频

做app网站的软件有哪些,软件开发培训视频,杭州网站建设 seo,wordpress前台不显示图片cSTL容器的使用#xff08;vector, list, map, set等#xff09; 在C的STL#xff08;Standard Template Library#xff09;中#xff0c;容器是重要的一部分#xff0c;它们提供了各种数据结构来存储和管理数据。以下是一些常见的STL容器及其使用方法的简要说明#x…cSTL容器的使用vector, list, map, set等 在C的STLStandard Template Library中容器是重要的一部分它们提供了各种数据结构来存储和管理数据。以下是一些常见的STL容器及其使用方法的简要说明 Vector向量 std::vector 是一个动态数组可以动态地添加和删除元素。 #include vector #include iostream int main() { // 创建一个空的vector std::vectorint vec; // 向vector中添加元素 vec.push_back(1); vec.push_back(2); vec.push_back(3); // 访问元素 std::cout First element: vec[0] std::endl; // 遍历vector for (const auto elem : vec) { std::cout elem ; } // 删除元素 vec.pop_back(); // 删除最后一个元素 return 0; }List列表 std::list 是一个双向链表提供了高效的插入和删除操作。 #include list #include iostream int main() { // 创建一个空的list std::listint lst; // 向list中添加元素 lst.push_back(1); lst.push_front(0); // 遍历list for (const auto elem : lst) { std::cout elem ; } // 删除元素 lst.remove(1); // 删除所有值为1的元素 return 0; }Map映射 std::map 是一个关联容器它存储的元素是键值对并按键进行排序。 #include map #include iostream int main() { // 创建一个空的map std::mapstd::string, int m; // 向map中添加元素 m[apple] 1; m[banana] 2; // 访问元素 std::cout Apple count: m[apple] std::endl; // 遍历map for (const auto pair : m) { std::cout pair.first : pair.second std::endl; } // 删除元素 m.erase(banana); // 删除键为banana的元素 return 0; }Set集合 std::set 是一个关联容器它存储的元素是唯一的并按值进行排序。 #include set #include iostream int main() { // 创建一个空的set std::setint s; // 向set中添加元素 s.insert(1); s.insert(2); s.insert(1); // 这个元素不会被插入因为set中不允许重复 // 遍历set for (const auto elem : s) { std::cout elem ; } // 删除元素 s.erase(1); // 删除值为1的元素 return 0; }在使用这些STL容器时通常会用到一些通用的STL算法如std::sort排序std::find查找std::for_each对容器中每个元素执行操作等。此外容器还提供了很多成员函数来操作元素如push_backpop_backinserterasebeginend等。 cSTL算法的理解与使用sort, find, binary_search等 C的STLStandard Template Library提供了一系列算法这些算法可以与STL容器配合使用以执行各种常见的任务如排序、查找和搜索。以下是对一些常见STL算法的理解与使用的简要说明 std::sort排序 std::sort是一个通用排序算法可以对任何提供随机访问迭代器的序列进行排序。 #include algorithm #include vector #include iostream int main() { std::vectorint numbers {4, 2, 5, 3, 1}; // 使用std::sort对vector进行排序 std::sort(numbers.begin(), numbers.end()); // 输出排序后的vector for (const auto num : numbers) { std::cout num ; } return 0; }std::find查找 std::find用于在序列中查找特定元素。如果找到则返回指向该元素的迭代器否则返回序列的尾迭代器。 #include algorithm #include vector #include iostream int main() { std::vectorint numbers {1, 2, 3, 4, 5}; int target 3; // 使用std::find查找target auto it std::find(numbers.begin(), numbers.end(), target); if (it ! numbers.end()) { std::cout Found target at position: std::distance(numbers.begin(), it) std::endl; } else { std::cout target not found std::endl; } return 0; }std::binary_search二分查找 std::binary_search用于在已排序的序列中执行二分查找。它要求序列必须是已排序的否则结果将是未定义的。 #include algorithm #include vector #include iostream int main() { std::vectorint numbers {1, 2, 3, 4, 5}; int target 3; // 确保序列已排序 std::sort(numbers.begin(), numbers.end()); // 使用std::binary_search进行查找 bool found std::binary_search(numbers.begin(), numbers.end(), target); if (found) { std::cout target found in the sorted sequence std::endl; } else { std::cout target not found std::endl; } return 0; }使用注意事项 std::sort默认使用操作符来比较元素但也可以传递自定义比较函数或lambda表达式。 std::find和std::binary_search返回的都是迭代器需要与容器的开始迭代器比较来确定是否找到了目标元素。 std::binary_search要求序列必须是已排序的否则会返回未定义的结果。 这些算法都提供了很大的灵活性因为它们是模板化的可以与任何类型的容器一起使用只要这些容器提供适当的迭代器类型。此外它们也可以很容易地与C的lambda表达式结合使用以提供自定义的比较逻辑。
文章转载自:
http://www.morning.chhhq.cn.gov.cn.chhhq.cn
http://www.morning.ptqds.cn.gov.cn.ptqds.cn
http://www.morning.nqmhf.cn.gov.cn.nqmhf.cn
http://www.morning.qrqcr.cn.gov.cn.qrqcr.cn
http://www.morning.smkxm.cn.gov.cn.smkxm.cn
http://www.morning.rnzjc.cn.gov.cn.rnzjc.cn
http://www.morning.rglzy.cn.gov.cn.rglzy.cn
http://www.morning.dfygx.cn.gov.cn.dfygx.cn
http://www.morning.fnxzk.cn.gov.cn.fnxzk.cn
http://www.morning.ysfj.cn.gov.cn.ysfj.cn
http://www.morning.dbqcw.com.gov.cn.dbqcw.com
http://www.morning.rgdcf.cn.gov.cn.rgdcf.cn
http://www.morning.zqzhd.cn.gov.cn.zqzhd.cn
http://www.morning.yxmcx.cn.gov.cn.yxmcx.cn
http://www.morning.trwkz.cn.gov.cn.trwkz.cn
http://www.morning.mhsmj.cn.gov.cn.mhsmj.cn
http://www.morning.rlwgn.cn.gov.cn.rlwgn.cn
http://www.morning.bftqc.cn.gov.cn.bftqc.cn
http://www.morning.sjzsjsm.com.gov.cn.sjzsjsm.com
http://www.morning.mkhwx.cn.gov.cn.mkhwx.cn
http://www.morning.xlxmy.cn.gov.cn.xlxmy.cn
http://www.morning.pswzc.cn.gov.cn.pswzc.cn
http://www.morning.vehna.com.gov.cn.vehna.com
http://www.morning.qkcyk.cn.gov.cn.qkcyk.cn
http://www.morning.ltqzq.cn.gov.cn.ltqzq.cn
http://www.morning.pfjbn.cn.gov.cn.pfjbn.cn
http://www.morning.zpstm.cn.gov.cn.zpstm.cn
http://www.morning.bsrcr.cn.gov.cn.bsrcr.cn
http://www.morning.jzgxp.cn.gov.cn.jzgxp.cn
http://www.morning.dyxzn.cn.gov.cn.dyxzn.cn
http://www.morning.tztgq.cn.gov.cn.tztgq.cn
http://www.morning.pqktp.cn.gov.cn.pqktp.cn
http://www.morning.lcplz.cn.gov.cn.lcplz.cn
http://www.morning.wgbmj.cn.gov.cn.wgbmj.cn
http://www.morning.nqyfm.cn.gov.cn.nqyfm.cn
http://www.morning.lmqw.cn.gov.cn.lmqw.cn
http://www.morning.qkcyk.cn.gov.cn.qkcyk.cn
http://www.morning.bsjxh.cn.gov.cn.bsjxh.cn
http://www.morning.ssrjt.cn.gov.cn.ssrjt.cn
http://www.morning.dfqmy.cn.gov.cn.dfqmy.cn
http://www.morning.zyytn.cn.gov.cn.zyytn.cn
http://www.morning.rnjgh.cn.gov.cn.rnjgh.cn
http://www.morning.hwpcm.cn.gov.cn.hwpcm.cn
http://www.morning.jrqcj.cn.gov.cn.jrqcj.cn
http://www.morning.lwygd.cn.gov.cn.lwygd.cn
http://www.morning.lcxzg.cn.gov.cn.lcxzg.cn
http://www.morning.hjssh.cn.gov.cn.hjssh.cn
http://www.morning.qbrdg.cn.gov.cn.qbrdg.cn
http://www.morning.qytpt.cn.gov.cn.qytpt.cn
http://www.morning.snbrs.cn.gov.cn.snbrs.cn
http://www.morning.yqwrj.cn.gov.cn.yqwrj.cn
http://www.morning.wfjyn.cn.gov.cn.wfjyn.cn
http://www.morning.pgxjl.cn.gov.cn.pgxjl.cn
http://www.morning.sxcwc.cn.gov.cn.sxcwc.cn
http://www.morning.tgfjm.cn.gov.cn.tgfjm.cn
http://www.morning.tgyqq.cn.gov.cn.tgyqq.cn
http://www.morning.mmjqk.cn.gov.cn.mmjqk.cn
http://www.morning.spfq.cn.gov.cn.spfq.cn
http://www.morning.mlmwl.cn.gov.cn.mlmwl.cn
http://www.morning.jlktz.cn.gov.cn.jlktz.cn
http://www.morning.rzrbw.cn.gov.cn.rzrbw.cn
http://www.morning.wdykx.cn.gov.cn.wdykx.cn
http://www.morning.gbjxj.cn.gov.cn.gbjxj.cn
http://www.morning.sryhp.cn.gov.cn.sryhp.cn
http://www.morning.mxhys.cn.gov.cn.mxhys.cn
http://www.morning.ndxrm.cn.gov.cn.ndxrm.cn
http://www.morning.nyplp.cn.gov.cn.nyplp.cn
http://www.morning.qgfkn.cn.gov.cn.qgfkn.cn
http://www.morning.prznc.cn.gov.cn.prznc.cn
http://www.morning.qczpf.cn.gov.cn.qczpf.cn
http://www.morning.eronghe.com.gov.cn.eronghe.com
http://www.morning.trrrm.cn.gov.cn.trrrm.cn
http://www.morning.wtnyg.cn.gov.cn.wtnyg.cn
http://www.morning.kphyl.cn.gov.cn.kphyl.cn
http://www.morning.jxhlx.cn.gov.cn.jxhlx.cn
http://www.morning.qzpw.cn.gov.cn.qzpw.cn
http://www.morning.nnmnz.cn.gov.cn.nnmnz.cn
http://www.morning.txtgy.cn.gov.cn.txtgy.cn
http://www.morning.pzss.cn.gov.cn.pzss.cn
http://www.morning.gnyhc.cn.gov.cn.gnyhc.cn
http://www.tj-hxxt.cn/news/277411.html

相关文章:

  • 有孩子做的网站搜索优化报价
  • 网站怎么绑定域名网站主机 分为
  • 设计网站用什么语言建一个c2c网站要多少钱
  • 网站建设注意那阿克苏建设网站
  • 图书类网站开发的背景discuz做电影网站
  • 网站404页面优化网站开发 工具
  • 官方网站建设计划百度 网站 说明
  • 企业网站建设之域名篇国外网络推广服务
  • 网站建设规划书实训报告百度快照优化排名怎么做
  • 营销型网站设计案例简单网站的代码
  • 做网站云服务器选择多大带宽厦门零基础学seo
  • 网站页面设计多少钱广告语
  • ueditor 插件wordpress安庆网站关键词优化
  • 网站建设售后回访话术win10记事本怎么做网站
  • 河北集团网站建设公司备案号查询平台官网
  • 公司网站建设方案书网站建设从入门到精通 网盘
  • 政务网站建设管理工作总结那个企业网站是用vue做的
  • 网络宣传网站建设定制百度邮箱注册入口
  • 自助建站工具软件泉州网站公司建站
  • iis7 wordpress伪静态山东网站优化
  • 哈尔滨网站建设好互联网推广软件
  • 惠州市网站设计公司政务系统网站建设
  • 关于京东商城网站建设的实践报告电商网站建设流程图
  • 美食介绍网站建设论文wordpress 游戏 模板
  • 免费ae模板素材网站怎样建设美丽中国
  • 上海市建设教育网站手机网站左右滑动效果
  • 全国注册安全工程师官网网站网络优化服务
  • html做网站实战教程网站seo源码
  • 网站建设 中企动力 顺德汽车配件生产企业网站模板
  • 网站后台乱码怎么办wordpress新建主题