fork download
  1. #include <stdio.h>
  2. void scanfall(int *x, int *y, int *z);
  3. void ascend(int *x, int *y, int *z);
  4. void swap(int *x, int *y);
  5. int main(void) {
  6. // your code goes here
  7. int a,b,c;
  8. scanfall(&a,&b,&c);
  9. printf("入力:a=%d:b=%d:c=%d\n", a, b, c);
  10. ascend(&a,&b,&c);
  11. printf("昇順:a=%d:b=%d:c=%d\n", a, b, c);
  12.  
  13. return 0;
  14. }
  15.  
  16. void scanfall(int *x,int *y,int *z)
  17. {
  18. scanf("%d", x);
  19. scanf("%d", y);
  20. scanf("%d", z);
  21.  
  22. }
  23.  
  24. void ascend(int *x, int *y, int *z)
  25. {
  26. if(y>x)
  27. swap(x, y);
  28. if(x>z)
  29. swap(x, z);
  30. if(y>z)
  31. swap(y, z);
  32.  
  33. }
  34.  
  35.  
  36. void swap(int *x, int *y)
  37. {
  38. int w;
  39.  
  40. w=*x;
  41. *x=*y;
  42. *y=w;
  43.  
  44. }
  45.  
Success #stdin #stdout 0s 5456KB
stdin
2 1 3
stdout
入力:a=2:b=1:c=3
昇順:a=1:b=2:c=3