解题思路:
注意事项:
参考代码:
#include<iostream> #include<cstdio> #include<set> #include<string> using namespace std; struct node { string str; int ans; bool operator<(const node &next) const { return ans<next.ans; } }; multiset<node>ms; char cs[20]; int main() { node st; int YY,MM,DD; while(scanf("%s",cs)!=EOF) { sscanf(cs,"%d/%d/%d",&MM,&DD,&YY); st.str=cs; st.ans=(YY*100+MM)*100+DD; ms.insert(st); } for(multiset<node>::iterator it=ms.begin();it!=ms.end();it++) { cout<<it->str<<endl; } return 0; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:646 |
C语言训练-求函数值 (C语言代码)浏览:911 |
C语言程序设计教程(第三版)课后习题7.5 (C语言代码)浏览:538 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:732 |
C语言考试练习题_一元二次方程 (C语言代码)浏览:733 |
P1001 (C语言代码)浏览:799 |
【偶数求和】 (C语言代码)浏览:639 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:1149 |
1051(奇了怪了)浏览:645 |
C二级辅导-求偶数和 (C语言代码)浏览:671 |