#include<stdio.h>
#define N 8
int main()
{
float score[N+1]={10,20,30,40,50,60,70,80};
float grade;
int loca,i;
printf("请输入代插入的成绩:");
scanf("%f",&grade);
if(grade>score[N-1])
score[N]=grade;
for(i=0;i<N;i++)
{
if(score[i]>grade)
{
loca=i;
break;
}
}
if(grade<score[0])
loca=0;
for(i=N-1;i>=loca;i--)
{
score[i+1]=score[i];
}
score[loca]=grade;
printf("插入后的数组:\n");
for(i=0;i<N+1;i++)
{
printf(" %.1f",score[i]);
}
putchar(10);
return 0;
}