STL中的map“元素通过键来存储和读取”中的“键”是什么
1个回答
展开全部
#include<map>
#include<string>
#include<iostream>
int main()
{
map<string,int> words;
map<string,int>::iterator it=words.begin();
for(;it!=words.end();++it)
cout<<"key:"<<it->first
<<"value:"<<it->second<<end1;
return 0;
}Top
#include<string>
#include<iostream>
int main()
{
map<string,int> words;
map<string,int>::iterator it=words.begin();
for(;it!=words.end();++it)
cout<<"key:"<<it->first
<<"value:"<<it->second<<end1;
return 0;
}Top
追问
所以这个“键”是迭代器么
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询