|
#include <stdio.h>
main ()
{
int n, i, j, * temp, * p, num;
printf ("input sum of the numbers\n");
scanf ("% d",&n);
num = n;
printf ("input numbers n <% d", num);
printf ("\n");
for (i = 0; i <n; i ++) scanf ("% d", p + i);
getchar ();
for (i = 0; i <n; i ++)
for (j = 0; j <n-i; j ++)
if (* (p + j + 1) <* (p + j))
(* temp = * (p + j); * (p + j) = * (p + j + 1); * (p + j + 1) = * temp;) / * bubble exchange * /
printf ("the sort:\n");
for (i = 0; i <n; i ++) printf ("% d", * (p + i));
printf ("\n");
getchar ();
} |
|