1个回答
展开全部
#include<stdio.h> struct student{ int num; char name[10]; int score; }; struct student stud[10]; void main() { int i,j,index,sum=0; struct student temp; printf("\nlnput thestudent's number,name and sxore:"); for(i=0;i<10;i++){ printf("No %d \n",i+1); scanf("%d%s%d",&stud[i].num,stud[i].name,&stud[i].score); sum=sum+stud[i].score; } for(i=0;i<9;++i){ index=i; for(j=i+1;j<10;j++) if(stud[j].score<stud[index].score) index=j; temp=stud[index]; stud[index]=stud[i]; stud[i]=temp; } printf("The acerage:%d\n",sum/10); printf("%d%s%d\n",stud[i].num,stud[i].name,stud[i].score); }
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询