STL map
来源:互联网 发布:文华日内期货模型源码 编辑:程序博客网 时间:2024/04/29 06:16
简单代码。随着学习会慢慢改
#include<map>#include<string>#include<iostream>using namespace std;int main(){map <int,string>map_student;map_student.insert(pair<int,string>(1,"student_one"));map_student.insert(map<int,string>::value_type(2,"student_two"));map_student[0] = "student_three";map<int,string>::iterator iter;for(iter = map_student.begin() ;iter != map_student.end();iter++) {cout << iter -> first <<" " << iter -> second << endl;}cout << endl;iter = map_student.find(1); if(iter != map_student.end()){cout << iter -> second << endl;}elsecout << "not find" << endl;cout << endl;iter = map_student.find(1);map_student.erase(iter); for(iter = map_student.begin() ;iter != map_student.end();iter++) {cout << iter -> first <<" " << iter -> second << endl;}cout << endl;}
希望有用
1 0
- STL-map
- stl -map
- stl map
- STL Map
- STL---map
- STL(MAP)
- STL(map)
- STL--map
- STL map
- stl map
- STL map
- STL----map
- stl map
- STL map
- 【STL】map
- STL--map
- STL map
- STL map
- ES6个人学习整理(二)——let和const
- iOS开发~CocoaPods使用详细说明
- 当输入流和输出流同时作用一个文件
- 运行于x86机器上的FreeBSD的PCI中断
- IO(输出流)
- STL map
- reactjs前端开发
- 解决eclipse中双击tomcat时server Locations无法编辑的问题
- 拓扑排序的实现_TopoSort
- SVN的Trunk、Branch和Tag(二)
- UML类图几种关系的总结
- SVN用户管理
- hadoop入门介绍
- html部分示例