#include <stdio.h>
#include <math.h>
int main()
{
int n[1000] = {0};
int Mount;
//数量
int Number, i, j,kk;
//插入数据
//初始化
printf("figure:");
scanf("%d", &Mount);
printf("n ge :");
for ( i = 0;i < Mount;i++)
{
scanf("%d", &n[i]);
}
//插入同时排序
printf("cha ru :");
{
scanf("%d", &Number);
}
for (i = 0; i < Mount; i++ )
{
for (j = i + 1; j < Mount; j++)
{
if (n[j] < n[i])
{
kk = n[i];
n[i] = n[j];
n[j] = kk;
}
}
}
for (i = Mount; i > 0;i--)
{
if (n[i - 1] > Number)
{
n[i] = n[i - 1];
continue;
}
n[i] = Number;
break;
}
//输出
for (i = 0;i <= Mount;i++)
printf("%d ", n[i]);
printf("\n");
return 0;
}
貌似可以,请版主指点