#include <iostream>
#include <cstring>
#include <map>
using namespace std;
int main(){
map<int,string>mapactor;
mapactor.insert(pair<int ,string>(1,"邓超"));
mapactor.insert(pair<int ,string>(2,"孙俪"));
mapactor.insert(pair<int ,string>(3,"黄晓明"));
map<int,string>::iterator i;
for(i = mapactor.begin();i!=mapactor.end();i++){
cout<<i->first <<' '<<i->second<<' '<<endl;
}
return 0;
}
#include <iostream>
#include <cstring>
#include <map>
using namespace std;
int main(){
map<int,string>mapactor;
mapactor.insert(map<int ,string>::value_type(1,"邓超"));
mapactor.insert(map<int ,string>::value_type(2,"孙俪"));
mapactor.insert(map<int ,string>::value_type(3,"黄晓明"));
map<int,string>::iterator i;
for(i = mapactor.begin();i!=mapactor.end();i++){
cout<<i->first <<' '<<i->second<<' '<<endl;
}
return 0;
}
#include <iostream>
#include <cstring>
#include <map>
using namespace std;
int main(){
map<int,string>mapactor;
mapactor[1] = "hxm";
mapactor[2] = "dc";
mapactor[3] = "sl";
map<int ,string>::iterator i;
for(i = mapactor.begin();i!= mapactor.end();i++){
cout << i->first <<' ' <<i->second <<endl;
}
return 0;
}
#include <iostream>
#include <cstring>
#include <map>
using namespace std;
int main(){
map<int,string>mapapple;
mapapple.insert(map<int,string>::value_type(1,"ipad"));
mapapple.insert(map<int,string>::value_type(2,"imac"));
mapapple.insert(map<int,string>::value_type(3,"iphone"));
int n = mapapple.size();
for(int i = 1;i<=n;i++){
cout <<mapapple[i]<<endl;
}
return 0;
}