Created
May 12, 2014 02:49
-
-
Save dd1994/73408a4cfc124b2cac1e to your computer and use it in GitHub Desktop.
This file contains 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> | |
void rank(int *p1, int *p2, int *p3); | |
void swap(int *p1, int *p2); | |
int main(void) | |
{ | |
int a, b, c; | |
while(scanf("%d %d %d", &a, &b, &c) != EOF) { | |
rank(&a, &b, &c); | |
printf("%d %d %d\n", a, b, c); | |
} | |
return 0; | |
} | |
void rank(int *p1, int *p2, int *p3) | |
{ | |
swap(p1, p2); | |
swap(p1, p3); | |
swap(p2, p3); | |
} | |
void swap(int *p1, int *p2) | |
{ | |
int temp; | |
if(*p1 > *p2) | |
{ | |
temp = *p1; | |
*p1 = *p2; | |
*p2 = temp; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment