热门搜索: 个人免签支付 素材网站源码 图片素材站源码 游戏源码 js广告 jquery选项卡 jQuery导航
2021-06-22 20:08
标签:mes name include algo bool string opera span typedef #include #include #include #include string> #include #include using namespace std; typedef pairstring,int> PAIR; struct cmp { bool operator()(const pairstring,int> &p1,const pairstring,int> &p2) { return p1.second > p2.second; } }; int main() { mapstring,int>mp; for(int i=0;i100;i+=10) { stringstream ss; ssi; string si = "m" + ss.str(); mp.insert(make_pair(si,i)); } for(mapstring,int>::iterator it = mp.begin();it!=mp.end();it++) { coutfirst " " second endl; } vectorstring,int>>vt(mp.begin(),mp.end()); sort(vt.begin(),vt.end(),cmp()); for(vectorstring,int>>::iterator it=vt.begin();it != vt.end();it++) { coutfirst " " second endl; } return 0; } C++Map按Value排序 标签:mes name include algo bool string opera span typedef 原文地址:https://www.cnblogs.com/achao123456/p/9676524.html
标签:mes name include algo bool string opera span typedef
#include #include #include #include string> #include #include using namespace std; typedef pairstring,int> PAIR; struct cmp { bool operator()(const pairstring,int> &p1,const pairstring,int> &p2) { return p1.second > p2.second; } }; int main() { mapstring,int>mp; for(int i=0;i100;i+=10) { stringstream ss; ssi; string si = "m" + ss.str(); mp.insert(make_pair(si,i)); } for(mapstring,int>::iterator it = mp.begin();it!=mp.end();it++) { coutfirst " " second endl; } vectorstring,int>>vt(mp.begin(),mp.end()); sort(vt.begin(),vt.end(),cmp()); for(vectorstring,int>>::iterator it=vt.begin();it != vt.end();it++) { coutfirst " " second endl; } return 0; }
C++Map按Value排序
原文地址:https://www.cnblogs.com/achao123456/p/9676524.html
上一篇:关于Python语言程序设计基础课程的思考
下一篇:Java 1004 成绩排名 (20 分)