Created
December 27, 2017 09:30
-
-
Save you74674/03a55ac9f17fe1cb9d7a7bd6ca9dea98 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include"compare.h" | |
int bigger(int a, int b) | |
{ | |
return a>b; | |
} | |
int smaller(int a, int b) | |
{ | |
return a<b; | |
} | |
int main() | |
{ | |
int C; | |
scanf("%d", &C); | |
for(int c=0; c<C; c++) | |
{ | |
int n; | |
char command[2]; | |
scanf("%s %d", command, &n); | |
int k[n]; | |
for(int i=0; i<n; i++) | |
scanf("%d", &(k[i])); | |
int (*compare)(int, int)=(command[0]=='>')?bigger:smaller; | |
sort(k, n, compare); | |
for(int i=0; i<n; i++) | |
printf("%d ", k[i]); | |
printf("\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment