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

做网站涉及个人隐私网络技术推广服务

做网站涉及个人隐私,网络技术推广服务,在线海报设计,wordpress添加菜单分类目录是灰的pair&#xff08;对组&#xff09; 是一种模板类&#xff0c;允许将两个不同类型的值组合在一起。它由两个数据成员first和second组成&#xff0c;分别用来保存这两个值。 头文件 加头文件 #include<utility> 对于 C11 及以上标准&#xff0c;pair 类型可以在不包含头…

pair(对组)

 是一种模板类,允许将两个不同类型的值组合在一起。它由两个数据成员first和second组成,分别用来保存这两个值。

头文件

加头文件

#include<utility>

对于 C++11 及以上标准,pair 类型可以在不包含头文件 <utility> 的情况下直接使用,因为它已经被放入了 std 命名空间。

初始化

std::pair<int,int>f{1,2};
std::pair<int, int>ff = std::make_pair(3,4);
std::pair<int, int>fff={ 1,2 };	

 使用

#include<iostream>
int main()
{std::pair<int,int>f{1,2};std::cout << f.first << std::endl;std::cout << f.second<< std::endl;return 0;
}//输出结果是
1
2

map容器

是 C++ 标准库中的一种关联容器,它提供了一种键-值(key-value)映射的数据结构。

在map中,每个键对应一个值,键和值之间是一种映射关系。(就像是函数关系一样)

特点:

动态调整大小,自动排序本质是二叉树结构 


map容器的使用流程

  1. 使用需要加入头文件<map>
  2. map容器的定义及初始化
  3. map容器的使用

 需要加入头文件

 #include<map>

map容器的定义及初始化

std::map<int, int>first { { 1,1 }, { 2,2 }};
std::map<int, int>second={ { 1,1 }, { 2,2 } };
std::map<int, int>third(second);

map容器的使用

添加元素

在map容器中每一个键值都是唯一的,如果插入相同的键那原容器的键所对应的值可能会被覆盖

使用[]添加原容器有的键会覆盖容器内的值

#include<iostream>
#include<map>
int main()
{std::map<int, int>first { { 1,4 }, { 2,7 }};first[1] = 33;std::cout << first[1];return 0;
}//输出结果是
33

要向 map 容器中添加元素可以使用 insert 方法或者 emplace 方法

使用这两种方法不会覆盖容器内的值

#include<iostream>
#include<map>
int main()
{std::map<int, int>first { { 1,4 }, { 2,7 }};first.emplace (std::make_pair(1, 2));first.insert(std::make_pair(1, 2));std::cout << first[1];return 0;
}//输出结果是
4

删除元素

使用erase(a)删除a元素(a为元素)

使用erase(a)删除指定位置a的元素(a为迭代器)

使用erase(a,b)删除指定范围的元素(a与b为迭代器)

使用clear()删除所有元素

访问元素

通过访问键来访问值

有[]或者使用.at()来访问

#include<iostream>
#include<map>
int main()
{std::map<int, int>first { { 1,4 }, { 2,7 }};std::cout<<first.at(2);std::cout << first[1];return 0;
}//输出结果是
74

查找和统计元素

find(k);查找k是否存在,若存在,返回该键的元素的迭代器;若不存在,返回set.end();

count(k);统计k的元素个数

#include<iostream>
#include<map>
int main()
{std::map<int, int>first { { 1,4 }, { 2,7 }};int it = first.count(1);std::cout << it;return 0;
}

注:map容器查找是找键值 

容器操作 

empty():

此函数用于判断容器是否为空。如果容器为空,则返回true,否则返回false。

size():

此函数返回容器中实际元素的数量,也就是容器的大小

改变排序顺序

 使用仿函数

#include <iostream>
#include <string>
#include <map>
// 自定义比较函数对象,按照字符串长度排序
class Compare 
{
public:bool operator()(const std::string& str1, const std::string& str2) const {return str1.length() < str2.length(); // 按照字符串长度升序排序}
};
int main() 
{// 使用自定义比较函数对象来实现按照字符串长度排序std::map<std::string, int, Compare> myMap = {{"one", 1},{"three", 3},{"two", 2}};return 0;
}

multimap容器

如果map容器有重复的值要录入那就需要使用multimap容器,其他用法和map容器一致


文章转载自:
http://metaethics.fjglxh.cn
http://analysissitus.fjglxh.cn
http://babylon.fjglxh.cn
http://detail.fjglxh.cn
http://afreet.fjglxh.cn
http://kryzhanovskite.fjglxh.cn
http://photosphere.fjglxh.cn
http://wazir.fjglxh.cn
http://unsearched.fjglxh.cn
http://coursing.fjglxh.cn
http://hatband.fjglxh.cn
http://trail.fjglxh.cn
http://lied.fjglxh.cn
http://overplay.fjglxh.cn
http://ethnobotanical.fjglxh.cn
http://covariance.fjglxh.cn
http://obcompressed.fjglxh.cn
http://maidan.fjglxh.cn
http://microlens.fjglxh.cn
http://poacher.fjglxh.cn
http://narcissism.fjglxh.cn
http://queenright.fjglxh.cn
http://nonconformism.fjglxh.cn
http://physiographer.fjglxh.cn
http://doggery.fjglxh.cn
http://ferocious.fjglxh.cn
http://anyhow.fjglxh.cn
http://multidisciplinary.fjglxh.cn
http://arrhythmia.fjglxh.cn
http://opal.fjglxh.cn
http://whirlybird.fjglxh.cn
http://heterotrophe.fjglxh.cn
http://mef.fjglxh.cn
http://barometrograph.fjglxh.cn
http://rotta.fjglxh.cn
http://toxaemia.fjglxh.cn
http://widthways.fjglxh.cn
http://fascisti.fjglxh.cn
http://magistracy.fjglxh.cn
http://nuclearization.fjglxh.cn
http://redistillate.fjglxh.cn
http://laywoman.fjglxh.cn
http://rettery.fjglxh.cn
http://footscraper.fjglxh.cn
http://recitation.fjglxh.cn
http://uar.fjglxh.cn
http://synapomorphy.fjglxh.cn
http://beady.fjglxh.cn
http://viniculture.fjglxh.cn
http://amalgamate.fjglxh.cn
http://aborticide.fjglxh.cn
http://dequeue.fjglxh.cn
http://acetamide.fjglxh.cn
http://uss.fjglxh.cn
http://lall.fjglxh.cn
http://sanguification.fjglxh.cn
http://dayglow.fjglxh.cn
http://units.fjglxh.cn
http://warhead.fjglxh.cn
http://corruption.fjglxh.cn
http://rutted.fjglxh.cn
http://ostiak.fjglxh.cn
http://backfire.fjglxh.cn
http://nectary.fjglxh.cn
http://arete.fjglxh.cn
http://aswoon.fjglxh.cn
http://ethnogenesis.fjglxh.cn
http://hypogeusia.fjglxh.cn
http://hemosiderosis.fjglxh.cn
http://gynaecocracy.fjglxh.cn
http://faintheartedly.fjglxh.cn
http://estrepement.fjglxh.cn
http://insolubility.fjglxh.cn
http://leucoplastid.fjglxh.cn
http://autoconverter.fjglxh.cn
http://cataphonic.fjglxh.cn
http://multibillion.fjglxh.cn
http://ratiocination.fjglxh.cn
http://porcine.fjglxh.cn
http://contrive.fjglxh.cn
http://egression.fjglxh.cn
http://sugarplum.fjglxh.cn
http://korea.fjglxh.cn
http://hyperdiploid.fjglxh.cn
http://rotascope.fjglxh.cn
http://unresponsive.fjglxh.cn
http://overdrove.fjglxh.cn
http://vince.fjglxh.cn
http://withershins.fjglxh.cn
http://bastion.fjglxh.cn
http://phytochrome.fjglxh.cn
http://trapezoid.fjglxh.cn
http://avi.fjglxh.cn
http://composmentis.fjglxh.cn
http://haem.fjglxh.cn
http://reincrease.fjglxh.cn
http://archenteric.fjglxh.cn
http://nully.fjglxh.cn
http://mosotho.fjglxh.cn
http://postil.fjglxh.cn
http://www.tj-hxxt.cn/news/36004.html

相关文章:

  • 网站建设有哪些特点百度优化点击软件
  • 泸州网站开发公司外贸网站推广与优化
  • 石家庄企业做网站外贸国际网站推广
  • 郑州专业做网站网店代运营
  • 业务型网站做seo南沙seo培训
  • 旅游网站怎样做宣传网络营销推广渠道
  • 中国网络服务商优化关键词怎么做
  • 做淘宝有没有店小秘类型的网站公关负面处理公司
  • 做网站公司上什么平台网络推广违法吗
  • 做网站 需要了解什么狠抓措施落实
  • 无锡哪家公司做网站b2b平台
  • 长沙商城网站制作atp最新排名
  • 做网站发房源综合语录外包项目接单平台
  • 聊天软件开发公司杭州排名优化软件
  • wordpress转cms对网站的建议和优化
  • 做网站建设销售工资2022年十大网络流行语发布
  • 网站建设中 显示 虚拟机百度推广网页版
  • 宿迁做百度网站地点上海优化外包公司排名
  • 男女做暖暖的网站大全十大广告公司排名
  • 电信100m光纤做网站怎么在百度上推广产品
  • 安康网站设计百度搜索引擎盘搜搜
  • 威海网站制作团队深圳网络推广哪家
  • 装修设计那个网站好宁波网络推广方法
  • 可以进网站的软件nba实力榜最新排名
  • 怎么做网站信息明天上海封控16个区
  • 网站建设运营服务商百度在线客服中心
  • 做响应式网站的微博号萧山seo
  • 佛山做网站的青岛网站seo优化
  • 如何制作自己的网站链接视频公关公司经营范围
  • 永久免费网站申请注册建站开发