当前位置:网站首页>STL map attribute
STL map attribute
2022-07-23 15:18:00 【joker_ 0030】
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
void MapOther()
{ // Define the object , And the assignment .( Insert value )
typedef pair<int ,char> in_pair;
map<int,char> db;//< Key value , actual value >
db.insert(in_pair(1,'a'));// Need and map There is a one-to-one correspondence between the types of .
db.insert(in_pair(2,'a'));
db.insert(in_pair(3,'a'));
db.insert(in_pair(4,'a'));
db.insert(in_pair(5,'a'));
//map in count Determine whether a key value exists .( Get the number of a certain element , Or judge whether a key value exists ).
cout << db.count(1) << endl;
//empty() Judge map Is it empty . Empty return 1, whereas 0.
cout << db.empty() << endl;
// Output space size
cout << db.size()<<endl;
// Iterator output
map<int, char>::iterator ite = db.begin();
for (ite; ite != db.end();ite++)
{
cout << ite->first << " " << ite->second << endl;
}
}
int main()
{
MapOther();
system("pause");
return 0;
}
边栏推荐
- C# 计算某个字符在字符串中出现的次数
- 基于PSO优化的多目标最优值求解matlab仿真
- 面试官:生成订单30分钟未支付,则自动取消,该怎么实现?
- 【OpenCV 例程200篇】225. 特征提取之傅里叶描述子
- Supervisor installation and use
- [turn] functional area division based on poi ()
- 智头条:智装论坛将于8月4日举行,2022全屋智能销售将破100亿
- Uniapp realizes horizontal click and slide menu
- 初识C语言函数
- Les raccourcis clavier liés à l'onglet ne peuvent pas être utilisés après la mise à jour du vscode
猜你喜欢

Matlab simulation of solving multi-objective optimal value based on PSO optimization

基于simulink的双闭环矢量控制的电压型PWM整流器仿真
![[CTFHub]JWT 的头部和有效载荷这两部分的数据是以明文形式传输的,如果其中包含了敏感信息的话,就会发生敏感信息泄露。试着找出FLAG。格式为 flag{}](/img/d0/133d628a304f5c6b5f0d514c9fe222.jpg)
[CTFHub]JWT 的头部和有效载荷这两部分的数据是以明文形式传输的,如果其中包含了敏感信息的话,就会发生敏感信息泄露。试着找出FLAG。格式为 flag{}

Live classroom system 01 database table design

Prometheus入门使用(三)

头部姿态估计原理及可视化_loveliuzz的博客-程序员宅基地_头部姿态估计

supervisord安装使用

动态规划-力扣

【OpenCV 例程200篇】225. 特征提取之傅里叶描述子

多项式承诺Polynomial commitment方案汇总
随机推荐
易基因|靶基因DNA甲基化测序(Target-BS)
如何加速矩阵乘法——优化GEMM (CPU单线程篇)
查找论文源代码
PostgreSQL has no NVL solution. PostgreSQL queries all tables
Live classroom system 03 model class and entity
基于matlab的CBOC信号调制解调仿真,输出其相关性,功率谱以及频偏跟踪
c语言:深度刨析const关键字
day18
bgp基本配置
turbo编译码误码率性能matlab仿真
Skills to learn before going to primary school
安全作业7.22
解决kotlin写Android项目编译报Execution failed for task ‘:app:kaptDebugKotlin‘.异常
Postgresql快照优化Globalvis新体系分析(性能大幅增强)
338. Bit count
Simulation of BOC modulation signal acquisition based on MATLAB
RSA加密的使用
152. Product maximum subarray
String与Integer互相转换
Simulink simulation of ESP three-phase SVPWM controller