將一個(gè)數(shù)插入已排好序列的數(shù)組里?
#include
int main()
{
int a[6] = {1,3,6,7,9};
int i,j,x,t;
printf("insert data:");
scanf("%d",&x);
for(i=0;i
if(x
break;
for(j=5;j>i;j--)
a[j]=a[j-1];
a[j]=x;
printf("Now array a:\n");
for(i=0;i
printf("%4d",a[i]);
printf("\n");
return 0;
}