1 #include <stdio.h>
2 #include <stdlib.h>
3
4 //主要注意qsort(s,s+5,sizeof(s),cmp)中各个参数的含义
5 /* ^
6 ^^^
7 ^^^^^
8 */
9 //int--------->qsort
10 int cmp(const void *a,const void *b){
11 //return *(int *)a>*(int *)b;//升序
12 return *(int *)a<*(int *)b;//降序
13 }
14 //======================================//
15
16 //double--------->qsort
17 int cmp1(const void *a,const void *b){
18 //return *(double *)a>*(double *)b?1:-1;//升序
19 return *(double *)a<*(double *)b?-1:1;//降序
20 }
21 //=====================================//
22
23 //char---------->qsort
24 int cmp2(const void *a,const void *b){
25 //return *(char *)a>*(char *)b;//升序
26 return *(char *)a<*(char *)b;//降序
27 }
28 //====================================//
29 int main(){
30 /*int s[5];
31 for(int i=0;i<5;i++){
32 scanf("%d",&s[i]);
33 }
34 qsort(s,5,sizeof(s[0]),cmp);
35 for(int j=0;j<5;j++){
36 printf("%d ",s[j]);
37 }*/
38
39 //=====================================//
40
41 /*double s[5];
42 for(int i=0;i<5;i++){
43 scanf("%lf",&s[i]);
44 }
45 qsort(s,5,sizeof(s[0]),cmp1);
46 for(int j=0;j<5;j++){
47 printf("%lf ",s[j]);
48 }*/
49
50
51 //===================================//
52
53 char s[5];
54 for(int i=0;i<5;i++){
55 scanf("%c",&s[i]);
56 getchar();
57 }
58 qsort(s,5,sizeof(s[0]),cmp2);
59 for(int j=0;j<5;j++){
60 printf("%c ",s[j]);
61 }
62
63 return 0;
64 }