- #include<bits/stdc++.h>
- using namespace std;
- map<int,string> mp;
- int main()
- {
- mp[2]="t";
- mp[7]="s";
- mp[1]="o";
- mp[5]="f";
- mp[6]="s";
- mp[9]="n";
- mp[6]="s2";
- for(auto p: mp)
- cout<<p.first<<": "<<p.second<<endl;
- cout<<"-------"<<endl;
- for(auto it=mp.begin(); it!=mp.end(); it++)
- cout<<(*it).first<<": "<<(*it).second<<endl;
- return 0;
- }
複製代碼 |