摘要: #include #include #include using namespace std; struct student { char num[10]; char name[10]; int grade; }s[100002]; int cmp1(student s1,student s2)//case 1 按照学号递增 { return strcmp(s... 阅读全文
posted @ 2017-03-15 18:18 贱人郭 阅读(160) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; struct string { char str[210]; }s[210]; void toLow(char c[]) { int len=strlen(c); for(int j=0;j='A' && c[j]<='Z') c[j]=c[j]-'... 阅读全文
posted @ 2017-03-15 17:25 贱人郭 阅读(202) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; struct string { char str[1005]; int len; }s[10000]; int main() { int k=0; int max=0,min=1001; while(scanf("%s",s[k].str)!=EOF) {... 阅读全文
posted @ 2017-03-15 16:31 贱人郭 阅读(181) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<stdlib.h>#include<string.h> using namespace std; struct string{ int len; char str[1005];}; int cmp(const void *str1,const vo 阅读全文
posted @ 2017-03-15 15:47 贱人郭 阅读(131) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; int main() { char *a=(char *)malloc(sizeof(char)); while(scanf("%s",a)!=EOF) { int len=strlen(a); sort(a,a+len); ... 阅读全文
posted @ 2017-03-15 12:51 贱人郭 阅读(142) 评论(0) 推荐(0) 编辑
摘要: sort()cmp函数容易出错; int cmp(Node a,Node b){ if (a.f!=b.f)return a.f>b.f; else { int f=strcmp(a.name,b.name);//直接写成 return a.name-b.name就错 return f<0; } } 阅读全文
posted @ 2017-03-15 12:09 贱人郭 阅读(167) 评论(0) 推荐(0) 编辑
摘要: #include #include using namespace std; int a[101]; int main() { int n; while(scanf("%d",&n)!=EOF) { int i; for(i=0;i<n;i++) scanf("%d",&a[i]); sort(a,a+... 阅读全文
posted @ 2017-03-15 11:04 贱人郭 阅读(180) 评论(0) 推荐(0) 编辑
摘要: #include #include #include using namespace std; struct Node { int c0; int c1; int m; }com[1001]; bool cmp(Node a,Node b) { if (a.m!=b.m) return a.m>b.m;//是大于号和小于号 else return a... 阅读全文
posted @ 2017-03-15 10:32 贱人郭 阅读(414) 评论(0) 推荐(0) 编辑