/** * order3 - a simple program that orders three numbers given on the command * line (or so I hope). */ #include #include #include "swap.h" int main (int argc, char *argv[]) { int a, b, c; if (argc != 4) { printf ("Usage: order n1 n2 n3\n"); return EXIT_FAILURE; } a = atoi (argv[1]); b = atoi (argv[2]); c = atoi (argv[3]); if (a > b) swap (&a, &b); if (b > c) swap (&b, &c); if (a > b) swap (&a, &b); printf ("%d %d %d\n", a, b, c); return EXIT_SUCCESS; } // main