返回列表 發帖
本帖最後由 林祐霆 於 2023-11-17 19:50 編輯
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. map<int, string> mp;
  4. int main()
  5. {
  6.     mp[3]="p";
  7.     mp[5]="l";
  8.     mp[7]="E";
  9.     mp[10]="s";
  10.     mp[2]="p";
  11.     mp[1]="a";
  12.     mp[3]="P";
  13.     /*
  14.     for(int i=0; i<=10; i++)
  15.         cout<<i<<": "<<mp[i]<<endl;
  16.     */
  17.     for(auto p: mp)
  18.         cout<<p.first<<": "<<p.second<<endl;
  19.     cout<<"-------"<<endl;
  20.     for(auto it=mp.begin(); it!=mp.end(); it++)
  21.         cout<<(*it).first<<": "<<(*it).second<<endl;
  22. }
複製代碼
林祐霆

TOP

返回列表