#include<map>
#include<cstdio>
using namespace std;
int main()
{
map<char,int> mymap;
mymap.insert(pair<char,int>('a',1));
mymap.insert(map<char,int>::value_type('b',2));
mymap['c']=3;
//三種插入方式
map<char,int>::iterator it;
for(it=mymap.begin();it!=mymap.end();it++)
printf("[%c,%d]",it->first,it->second);
printf("\n");
}
第一個是run code結果,第二個是f5、ctrl+f5的結果


轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/248229.html
標籤:工具平臺和程序庫
上一篇:回呼函式中寫日志崩潰
下一篇:結構體無法賦值問題
