I'm sorry, but your code just isn't what I've come to expect from a promising Cprog member such as yourself. I was expecting a program more like this:
Code:
#include <stdio.h>
int main ( void )
{
int array[10];
int n, i, j;
/* Fill the array */
printf ( "Enter up to ten numbers: " );
fflush ( stdout );
for ( n = 0; n < 10; n++ ) {
if ( scanf ( "%d", &array[n] ) != 1 )
break;
}
/* Sort the array by insertion */
for ( i = 1; i < n; i++ ) {
int save = array[i];
for ( j = i - 1; j >= 0 && array[j] > save; j-- )
array[j + 1] = array[j];
array[j + 1] = save;
}
/* Print the sorted array */
for ( i = 0; i < n; i++ )
printf ( "%d\n", array[i] );
return 0;
}
I'm going to have to fail you for this post, hopefully that will encourage you to do better in the future.
Your score: F