#include <stdio.h>
#define kCount 10
int main()
{
int array[kCount] = {92, 77, 67, 8, 6, 84, 55, 85, 43, 67};
for (int i = 1; i<kCount; i++) {
int temp = array[i];
int j = i-1;
while (temp<array[j]) {
array[j+1] = array[j];
j--;
if (j==-1) {
break;
}
}
array[j+1] = temp;
}
for (int i = 0; i<kCount; i++) {
printf("%d\t", array[i]);
}
return 0;
}
时间: 2024-10-05 23:47:43