返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. map<int,string> mp;
  4. int main()
  5. {
  6.     mp[2]="t";
  7.     mp[7]="s";
  8.     mp[1]="o";
  9.     mp[5]="f";
  10.     mp[6]="s";
  11.     mp[9]="n";
  12.     mp[6]="s2";   

  13.     for(auto p: mp)  
  14.         cout<<p.first<<": "<<p.second<<endl;

  15.     cout<<"-------"<<endl;

  16.     for(auto it=mp.begin(); it!=mp.end(); it++)
  17.         cout<<(*it).first<<": "<<(*it).second<<endl;
  18.     return 0;
  19. }
複製代碼

TOP

返回列表