Title Description
Enter the names of 5 students in a class and their math and English scores to calculate the average score for each student, and then output the names of the students with the highest average score and the scores of maths and English.
Input requirements
Enter the names of 5 students in a class and their math and English scores. The name is a string that is not more than 19 characters in length, and the result is represented by an integer.
Output requirements
Output the name and average of each student, the average number of floating-point numbers, the output is accurate to 1 digits after the decimal point.
The names of the students with the highest average scores were then printed, as well as math and English.
If the input
AAA 88bbb 89CCC 82ddd 85 66eee 66
should be output
AAA 74.5bbb 76.0CCC 73.0ddd 75.5eee 75.5The Max SCORE:BBB 63 89
1#include <stdio.h>2 structstudent{3 Charname[ -];4 intMath;5 int中文版;6 floataverage,sum;7 };8 intMainvoid)9 { Ten intI,max; One structStudent stud[5]; A - for(i=0;i<5; i++){ -scanf"%s",&stud[i].name); thescanf"%d",&Stud[i].math); -scanf"%d",&Stud[i]. 中文版); -stud[i].sum=stud[i].math+Stud[i]. 中文版; -Stud[i].average =stud[i].sum/2; + } - for(i=0;i<5; i++) +printf"%s%.1f\n", Stud[i].name, stud[i].average); A atmax=0; - for(i=1;i<5; i++){ - if(stud[max].average<stud[i].average) -max=i; - } -printf"The Max Score:%s%d%d\n", Stud[max].name, Stud[max].math, Stud[max]. 中文版); in return 0; -}
"Structure" average score and highest score