首页 > 代码库 > 140809暑期培训
140809暑期培训
1、用sort对结构体中字符串进行二级排序
2、对于某些题给定了你要求变量的范围,在写好程序之后千万记得将所给范围的最大值代入
程序试一下,看看是否会超出int的的范围,如果超出int范围,则改成__int64,%I64d。
#include<string.h> #include<algorithm> using namespace std; struct s { int d; char c[10]; }ss[15]; bool cmp(s a,s b) { if(strcmp(a.c,b.c)!=0) return strcmp(a.c,b.c)<0; else return a.d<b.d; }
2、对于某些题给定了你要求变量的范围,在写好程序之后千万记得将所给范围的最大值代入
程序试一下,看看是否会超出int的的范围,如果超出int范围,则改成__int64,%I64d。
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。