#define ARR_SISE 30
float score[ARR_SISE];
char *num[ARR_SISE];
float aver=0;
void readscore()
{
int n=0;
for(n=0;n<ARR_SISE;n++)
{
printf("请è¾å
¥ç¬¬%d个人çä¿¡æ¯:\n",n);
scanf("%f%s",&score[n],num+n);
}
}
void getfail()
{
int n,m=0;
for(n=0;n<ARR_SISE;n++)
{
if(score[n]<60)
{
m++;
}
}
if(m==0)
printf("没æä¸åæ ¼ç人!\n");
else
{
printf("ä¸åæ ¼ç人æ%d个,ä»ä»¬æ¯:\n",m);
for(n=0;n<ARR_SISE;n++)
{
if(score[n]< 60)
{
printf("%s ",num+n);
}
}
printf("\n");
}
}
void getAver()
{
int n;
float sum=0.0;
for(n=0;n<ARR_SISE;n++)
sum+=score[n];
aver=sum/ARR_SISE;
printf("å¹³ååæ¯:%2f\n",aver);
}
void getAboveAver()
{
int n=0,m=0;
printf("å¨å¹³ååä¹ä¸ç人æ¯:");
for(n=0;n<ARR_SISE;n++)
{
if(score[n] > aver)
{
printf("%s\t",num+n);
m++;
}
}
printf("\nå
±æ%d个\n",m);
}
void getdetail()
{
int n,i=0,j=0,k=0,m=0;
for(n=0;n<ARR_SISE;n++)
{
if(score[n]< 60)
j++;
else if(score[n] > 60&&score[n] < 70)
i++;
else if(score[n] >70&&score[n] < 80)
k++;
else m++;
}
printf("ä¸åæ ¼çæ:%2f%%\n",(j*100.0)/ARR_SISE);
printf("60~70çæ:%2f%%\n",(i*100.0)/ARR_SISE);
printf("70~80çæ:%2f%%\n",(k*100.0)/ARR_SISE);
printf("80以ä¸çæ:%2f%%\n",(m*100.0)/ARR_SISE);
}
void main()
{
readscore();
getfail();
getAver();
getAboveAver();
getdetail()
}
温馨提示:答案为网友推荐,仅供参考