#include
#include
#define MAX_NUM 100
typedef struct STUDNET{
char name[20];
int Chinese;
int Math;
int English;
int Total;
}Student;
int main()
{
int num, i , index;
int max = 0;
Student s[MAX_NUM];
printf("请输入学生数目:");
scanf("%d",&num);
for(i = 0; i < num; i ++)
{
printf("第%d个学生姓名:",i+1);
scanf("%s",s[i].name);
printf("成绩:\n");
printf("\t语文:");
scanf("%d",&s[i].Chinese);
printf("\t数学:");
scanf("%d",&s[i].Math);
printf("\t英语:");
scanf("%d",&s[i].English);
s[i].Total = s[i].Chinese + s[i].Math + s[i].English;
if(s[i].Total > max)
{
max = s[i].Total;
index = i;
}
}
printf("\n");
printf("==================================================\n");
printf("||\t姓名\t语文\t数学\t英语\t总分\t||\n");
for(i = 0; i < num; i ++)
{
printf("||\t%s\t%d\t%d\t%d\t%d\t||\n",s[i].name,s[i].Chinese,s[i].Math,s[i].English,s[i].Total);
}
printf("==================================================\n");
printf("\n总分最高学生:\n");
printf("==========================================================\n");
printf("||\t姓名:\t\t%s\t\t\t\t||\n",s[index].name);
printf("||\t语文:\t\t%d\t\t\t\t||\n",s[index].Chinese);
printf("||\t数学:\t\t%d\t\t\t\t||\n",s[index].Math);
printf("||\t英语:\t\t%d\t\t\t\t||\n",s[index].English);
printf("||\t总分:\t\t%d\t\t\t\t||\n",s[index].Total);
printf("==========================================================\n");
}