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

企业网站的缺点湖南专业seo推广

企业网站的缺点,湖南专业seo推广,做网站用linux哪个版本,网站设计 趋势【STL map 简介】 ● STL map 是一种关联容器,存储键值对,每个键(key value)是唯一的,而值(mapped value)可以重复。构建 STL map 时,无论元素插入顺序如何,STL map 中的…

【STL map 简介】
● STL map 是一种关联容器,存储键值对,每个键(key value)是唯一的,而值(mapped value)可以重复。构建 STL map 时,无论元素插入顺序如何,STL map 中的元素始终
按“键值”自动递增存储。STL map 中的迭代器可理解为“指针”。

#include <bits/stdc++.h>
using namespace std;map<int,string> mp;
int idx;
string name;
int n;int main() {cin>>n;while(n--) {cin>>idx>>name;mp.insert({idx,name});}for(auto it=mp.begin(); it!=mp.end(); it++) {cout<<it->first<<":"<<it->second<<endl;}return 0;
}/*
in:
5
3 Java
1 C++
9 Python
8 R
6 SQLout:
1:C++
3:Java
6:SQL
8:R
9:Python
*/

● STL map 常用函数的功能与 STL set 常用函数的功能基本一致
(1)
lower_bound(x):返回一个迭代器,该迭代器指向第一个大于等于 x 的元素。若无,返回 end() 得到的迭代器。
(2)
upper_bound(x):返回一个迭代器,该迭代器指向第一个大于 x 的元素。若无,返回 end() 得到的迭代器。
(3)
find(x):返回一个迭代器,该迭代器指向“键 x”所在的元素。
(4)erase(first, last):从 map 中删除迭代器 first 及迭代器 last 指向的区间 [first, last) 中的元素(注意:左闭右开)。

#include <bits/stdc++.h>
using namespace std;int main() {map<int,string> mp= {{9,"a"}, {7,"b"}, {2,"c"}, {6,"d"}};auto first=mp.find(2);auto last=mp.find(7);mp.erase(first,last);for(auto it=mp.begin(); it!=mp.end(); it++) {cout<<it->first<<":"<<it->second<<endl;}return 0;
}/*
output:
7:b
9:a
*/

(5)begin():返回一个迭代器,该迭代器指向 map 第一个元素的位置
(6)
end():返回一个迭代器,该迭代器指向 map 最后一个元素的下一个位置
(7)
count(x):返回 map 中“键” x 的个数。

#include <bits/stdc++.h>
using namespace std;int main() {map<int,string> mp= {{6,"apple"},{8,"banana"}};cout<<mp.count(6)<<endl;  //output 1cout<<mp.count(5)<<endl;  //output 0return 0;
}

由于 map 中所有“键”的个数都是唯一的,所以若 x 在 map 中,返回 1,若 x 不在 map 中,返回 0。



【参考文献】
https://cplusplus.com/reference/map/map/
https://cplusplus.com/reference/map/map/count/
https://cplusplus.com/reference/map/map/lower_bound/
https://cplusplus.com/reference/map/map/upper_bound/
https://cplusplus.com/reference/map/map/insert/
https://cplusplus.com/reference/map/map/erase/
https://cplusplus.com/reference/map/map/begin/
https://www.cnblogs.com/linxiaoxu/p/17694869.html


 

http://www.ds6.com.cn/news/33170.html

相关文章:

  • 免费网站客服工具营销型网站策划
  • 网站建设成本图超级外链吧
  • 设计之家官方网站域名权重是什么意思
  • 响应式布局实现搜索引擎优化是做什么的
  • 自己建网站做外贸微信软文范例
  • 网站建设 inurl:.bbs中国网站排名前100
  • 阜宁县住房与城乡建设局网站外链
  • 网站建设服务 杭州百度站长工具
  • 做网站会用到什么语言网络关键词
  • 自己做个网站好还是做别人会员好南通seo
  • 免费自助创建网站百度账号登录入口网页版
  • 会计专业简历制作深圳seo顾问
  • 电影下载网站模板seo推广培训课程
  • 网站怎么不花钱做排名 知乎网页制作成品
  • 济南 网站建设某企业网站的分析优化与推广
  • asp网站空间申请注册网站流程
  • 苏州那家公司做网站好十大流量平台
  • 上海的网站公安备案查询郑州seo网站管理
  • 艺客网站首页谷歌play商店
  • 什么网站可以免费做兼职磁力狗bt
  • 孝义网站开发公司宁波网站建设团队
  • 成人大专毕业自我鉴定页面seo是什么意思
  • 江苏网站备案流程图合肥网站seo整站优化
  • 电脑要登入国外的网站应该怎么做长春seo按天计费
  • 彩票网站链接怎么做醴陵网站制作
  • 建设局官网查询优化关键词的公司
  • 购物网站设计欣赏北京seo分析
  • 邢台网站制作哪里有网络营销经典成功案例
  • 三级分销网站制作找代写文章写手
  • 上海龙象建设集团公司网站新闻联播今日新闻