map 样例
来源:互联网 发布:电子地图编辑软件 编辑:程序博客网 时间:2024/04/29 04:23
#include "stdafx.h"#include<map>#include<string>#include<iostream>using namespace std;int main(){typedef pair<string, int> Item;typedef map<string, int> myMap;myMap simap;simap[string("xiao")] = 0;simap[string("ben")] = 1;simap[string("dan")] = 2;// 另一种插入数据的方式simap.insert(Item("jun", 5));// 打印信息myMap::iterator it = simap.begin();myMap::iterator itEnd = simap.end();for (NULL; it != itEnd; ++it){cout << it->first << " " << it->second << endl;}// myMap::iterator itFind = simap.find("jun");if (itFind == simap.end()){cout << " jun not found..." << endl;}else{cout << "jun had found : " << itFind->second << endl;itFind->second = 100000;}cout << "jun: " <<simap[string("jun")] << endl;}
0 0
- map 样例
- map
- MAP
- map
- MAP
- map
- map
- map
- Map
- Map
- Map
- map
- map
- Map
- .map
- map
- MAP
- map
- STL array的rend方法(17)
- BaseDB MongoDb dao数据库操作类
- Leetcode 细节实现 Rotate Image
- android双击灭屏
- Façade(外观模式)
- map 样例
- Linux分区、格式化、加载磁盘
- Cocos2d-x JNI使用--震动
- 门禁管理
- 运算符重载为友元函数
- tar,gunzip,gzip,unzip和zgrep 命令的区别
- Servlet登陆功能的实现
- SPI模块的HAL访问Linux内核驱动程序
- POJ 1279 Art Gallery 题解