与其暂时很生,不知其如何迭代

#include<iostream>
#include<map>
using namespace std;
int main()
{
    
    char m,r,a;
map<char,int> mp;
mp['m']=20;
mp['r']=30;
mp['a']=40;
for(map<char,int>::iterator it=mp.begin();it!=mp.end();it++)
printf("%c %d\n",it->first,it->second);
}

在这里插入图片描述
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_51082388/article/details/112169518