#include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
map<int,string>student;
student[1]="student_one";
student[2]="student_two";
student[4]="student_four";
map<int,string>::iterator it;
int a=student.count(2);
map<int,string>::iterator b;
b=student.find(4);
cout<<a<<" "<<b->first<<endl;
就是->first那里,我想知道当key为4的时候的位置,就是想输出3,第三个位置嘛,但是却输出4了。。。求问大佬们怎么改
for(it=student.begin();it!=student.end();it++)
{
cout<<it->first<<" "<<it->second<<endl;
}
return 0;
}