本帖最後由 林祐霆 於 2023-11-17 19:50 編輯
- #include<bits/stdc++.h>
- using namespace std;
- map<int, string> mp;
- int main()
- {
- mp[3]="p";
- mp[5]="l";
- mp[7]="E";
- mp[10]="s";
- mp[2]="p";
- mp[1]="a";
- mp[3]="P";
- /*
- for(int i=0; i<=10; i++)
- cout<<i<<": "<<mp[i]<<endl;
- */
- 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;
- }
複製代碼 |