#include #include #define N 1000000 int main () { int v[N], n, i, j, t, did_swaps; n = 0; for (;;) { scanf ("%d", &v[n]); if (feof (stdin)) break; n++; if (n >= N) { fprintf (stderr, "too many numbers!\n"); exit (1); } } did_swaps = 1; while (did_swaps) { did_swaps = 0; /* to remove to animation, delete the following five lines */ system ("clear"); for (j=0; j v[j]) { /* swap them */ t = v[j]; v[j] = v[j-1]; v[j-1] = t; did_swaps = 1; } } } printf ("the sorted array is:\n"); for (i=0; i