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

绵阳建网站提高网站流量的软文案例

绵阳建网站,提高网站流量的软文案例,页面设计读书笔记1500,食品营销型网站文章目录 一、set系列1.set①insert②find③erase④lower_bound与upper_bound 2.multiset①count②equal_range 二、map系列1.map①insert1.插入pair的四种方式2.常用两种方式 ②[]2.multimap①count②equal_range 一、set系列 1.set ①insert 函数分析(C98&…

文章目录

  • 一、set系列
    • 1.set
      • ①insert
      • ②find
      • ③erase
      • ④lower_bound与upper_bound
    • 2.multiset
      • ①count
      • ②equal_range
  • 二、map系列
    • 1.map
      • ①insert
        • 1.插入pair的四种方式
        • 2.常用两种方式
      • ②[]
      • 2.multimap
        • ①count
        • ②equal_range

一、set系列

1.set

①insert

  • 函数分析(C++98):
    在这里插入图片描述
  • 简单使用:
	set<int> s;s.insert(5);s.insert(6);s.insert(7);s.insert(9);s.insert(8);s.insert(1);s.insert(2);s.insert(3);s.insert(4);s.insert(4);s.insert(4);s.insert(4);for (auto e : s){cout << e << " ";}
  • 运行结果:

在这里插入图片描述

可见:set具有天然的去重和排序功能—— 二叉搜索树的结构

②find

  • 函数分析:

在这里插入图片描述

  • 简单应用:
	set<int> s;s.insert(5);s.insert(6);s.insert(7);s.insert(9);s.insert(8);s.insert(1);s.insert(2);s.insert(3);s.insert(4);set<int>::iterator it = s.find(8);if (it != s.end()){cout << "找到了" << endl;}else{cout << "没找到" << endl;}

③erase

  • 函数分析:
    在这里插入图片描述

  • 简单应用:

	set<string> s;s.insert("张三");s.insert("李四");s.insert("王五");size_t n = s.erase("王五");cout << n << endl;set<string>::iterator it = s.find("李四");if (it != s.end()){it = s.erase(it);if(it != s.end())cout << *it << endl;}
  • 运行结果:

在这里插入图片描述

④lower_bound与upper_bound

  • 函数分析

在这里插入图片描述

  • 简单使用
std::set<int> myset;
std::set<int>::iterator itlow, itup;for (int i = 1; i < 10; i++)// 10 20 30 40 50 60 70 80 90 myset.insert(i * 10);		for (auto e : myset)
{cout << e << " ";
}
cout << endl;itlow = myset.lower_bound(30);
itup = myset.upper_bound(60);
//为了删除[30,60]且符合迭代器区间的左闭右开的规则,因此最终调整为:[30,70)auto it = myset.erase(itlow, itup);if(it != myset.end())cout << *it << endl;for (auto e : myset)
{cout << e << " ";
}
  • 运行结果
    在这里插入图片描述

2.multiset

  • 基本与set一致,这里介绍几个适合它使用的。
  • 强调一点,mutiset可以存相同数据!

①count

  • 函数分析
    在这里插入图片描述

  • 简单使用

	multiset<int> s;s.insert(1);s.insert(1);s.insert(2);s.insert(3);s.insert(4);for (auto e : s){cout << e << " ";}cout << endl;cout << s.count(1) << endl;
  • 运行结果
    在这里插入图片描述

②equal_range

函数分析:
在这里插入图片描述

  • 简单运用:
	multiset<int> s;s.insert(1);s.insert(1);s.insert(1);s.insert(1);s.insert(2);s.insert(3);s.insert(4);//pair<multiset<int>::iterator, multiset<int>::iterator> it = s.equal_range(1);auto it = s.equal_range(1);//区间为:[1,2)auto begin = it.first;auto end = it.second;while (begin != end){cout << *begin << " ";begin++;}cout << endl;
  • 运行结果
    在这里插入图片描述

强调:

  1. 在插入相同值时,并不能保证稳定性,即相同数据的前后顺序会不会发生改变——涉及AVL树。
  2. set系列的迭代器,在底层都是const迭代器,表明其值是不能被修改的,在底层上来讲,如果修改了,就破坏了二叉搜索树的结构。

二、map系列

1.map

①insert

1.插入pair的四种方式

	map<string, string> dict;//第一种方式:命名对象插入pair<string, string> p("insert", "插入");dict.insert(p);//第二种方式:直接用匿名对象进行插入dict.insert(pair<string, string>("sort", "排序"));//第三种方式:make_pair交由函数(底层会被优化成内联)—— C++98。//推荐使用这种,因为大多数都支持。//C++98只支持单参数的构造函数dict.insert(make_pair("object", "对象"));//第四种方式:{} ——C++11采用了这种方式从而支持了多参数的构造函数。dict.insert({ "English","英语" });
  • 补充:make_pair函数——C++98
    在这里插入图片描述

2.常用两种方式

	//字典序map<string, string> dict;dict.insert(make_pair("object", "对象"));dict.insert(make_pair("insert", "插入"));dict.insert(make_pair("sort", "排序"));dict.insert(make_pair("English", "英语"));for (const auto& e : dict){cout << e.first << ":" << e.second << endl;}//查找次数string strs[] = { "苹果", "西瓜", "苹果", "樱桃", "苹果", "樱桃"\, "苹果", "樱桃", "苹果" };map<string, int> countMap;for (const auto& e : strs){auto it = countMap.find(e);if (it != countMap.end()){(it->second)++;}else{countMap.insert(make_pair(e, 1));}}for (const auto& e : countMap){cout << e.first << ":" << e.second << endl;}

②[]

  • 函数原理分析:

在这里插入图片描述

  • 简单使用
	string strs[] = { "苹果", "西瓜", "苹果", "樱桃", "苹果", "樱桃", \"苹果", "樱桃", "苹果" };map<string, int> countMap;for (const auto& e : strs){countMap[e]++;}for (const auto& e : countMap){cout << e.first << ":" << e.second << endl;}
  • 时间复杂度:因为底层是二叉搜索树的结构,因此为logN(底层是优化了的,包括最坏情况也优化成了大概logN)。

  • 补充:map对已有元素,是不会再进行插入和覆盖的,至少在VS下是这样。

2.multimap

  • 说明:因为支持了重复元素的插入,因此不存在[]运算符重载。

①count

  • 基本用法同multiset

  • 简单应用:

	multimap<string, string> dict;dict.insert(make_pair("tell", "告诉"));dict.insert(make_pair("tell", "分辨"));dict.insert(make_pair("hot", "热的"));dict.insert(make_pair("hot", "性感的"));for (const auto& e : dict){cout << e.first << ":" << e.second << endl;}size_t n = dict.count("tell");//这里模拟的是一词多义,即tell有几种意思。cout <<"tell有:" << n <<"种意思" << endl;

②equal_range

  • 用法同multiset

  • 简单运用:

	multimap<string, string> dict;dict.insert(make_pair("tell", "告诉"));dict.insert(make_pair("tell", "分辨"));dict.insert(make_pair("hot", "热的"));dict.insert(make_pair("hot", "性感的"));//pair<multimap<string, string>::const_iterator, \multimap<string, string>::iterator> \it = dict.equal_range("tell");//tell的几个意思分别是auto it = dict.equal_range("tell");auto begin = it.first;auto end = it.second;while (begin != end){cout << begin->first << ":" << begin->second << endl;begin++;}
http://www.wangmingla.cn/news/165549.html

相关文章:

  • 免费公司企业建站代理刷神马seo排名首页排名
  • 用什么软件可以制作图片seo排名赚app
  • 媒体发稿网站开发大数据精准营销获客
  • 平度做网站seo搜索引擎优化求职简历
  • 团购网站开发需要多久win7优化大师下载
  • 鸟人 网站建设搜索引擎优化概述
  • 做企鹅号的视频素材网站北京seo
  • 做游戏动画外包网站seo公司排名
  • php网站开发技术百度 站长工具
  • 黄江镇做网站优化网站有哪些方法
  • 中国十大购物网站排行榜宝鸡seo优化
  • 网站建设人才调研重庆森林粤语
  • 宁夏网站设计360seo排名点击软件
  • flipaclip动画制作seo诊断分析工具
  • 娄底网站建设百度快照下载
  • 湛江网站制作工具郑州网站顾问
  • 广东网站建设包括什么百度竞价推广代理
  • 买卖网站域名骗局平面设计
  • 做无障碍浏览网站郴州网络推广公司排名
  • 做销售网站要多少钱seo百度贴吧
  • 专业网站建设设计装饰网站建站价格
  • 企业网站开发多少钱申请一个网站
  • c语言做网站后台百度客户服务中心
  • 做网站和做app的区别软件开发工程师
  • web前端开发难学吗处理器优化软件
  • 企业密信东莞公司seo优化
  • 做外贸有什么免费网站网站首页面设计
  • 网站建设续费的回访话术软文形式推广产品
  • 免费的网站客服系统seo sem什么意思
  • 营销型网站建设公司优化培训课程