map容器
2015-08-20 09:59
183 查看
#include <map> using namespace std; void __fastcall TForm1::Button22Click(TObject *Sender) { map<int ,AnsiString> myMap;//定义对象 map<int ,AnsiString>::iterator it_find;//遍历指针 myMap.insert(make_pair(1,"One"));//添加 myMap.insert(make_pair(2,"two")); it_find = myMap.find(2); //查找 if(it_find != myMap.end()) { it_find->second = it_find->second + " hello";//改写 ShowMessage(it_find->second); //读取 } else { ShowMessage("未找到"); } myMap.erase(1);//删除 }
相关文章推荐
- Notification的学习,4.0前后的差别,和在设置声音的时候获取资源的uri方法
- Linux Format Udisk As Ext3 format
- HttpClient的get和post
- outlook上添加qq邮箱注意的3点事项
- 深入理解C语言指针的奥秘(转)
- android--面试题:多次点击事件处理
- 自定义spinner
- hdu1080 LCS变形
- handsontable 问题
- RSAT for Windows10
- SQL语法2
- UIElementCollection
- 嵌入式个人规划
- dpkg: error processing package bluez (--configure) 解决方法
- 函数指针与指针函数
- (转)Ajax的原理和应用
- !!!!!!!【unittest】unittest需要懂的的技术
- PHP5.4 linux 编译
- 如何不使用第三方变量交换两个变量的值
- 九度oj-1134-密码翻译