?? maptest.cpp
字號:
// mapTest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <map>
#include <string>
#include <algorithm>
#include "iostream"
using namespace std;
typedef map<string,int> strMap;
int main(int argc, char* argv[])
{
strMap mapTest;
mapTest[string("jjhou")]=0;
mapTest[string("Jerry")]=1;
mapTest[string("jason")]=2;
pair<string,int>value(string("david"),3);
mapTest.insert(value);
strMap::iterator it=mapTest.begin();
for (;it!=mapTest.end();it++)
{
cout<<it->first<<' '<<it->second<<endl;
}
//實現元素的查找
strMap::iterator itel;
itel=mapTest.find(string("mchen"));
if (itel==mapTest.end())
{
cout<<"mchen not found"<<endl;
}
itel=mapTest.find(string("Jerry"));
if(itel!=mapTest.end())
{
cout<<"jerry found"<<endl;
}
itel->second=9;
cout<<"The jerry= "<<itel->second<<endl;
printf("Hello World!\n");
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -