"C language" has n structure variables, including student number, name and three class results. The information required to output the highest average scores of students.

Source: Internet
Author: User

There are n structure variables, including student number, name and three class results. The information required to output the highest average scores of students. #include <stdio.h> #define N 3struct student{int num;char name[20];float socre[3];float aver;}; void input (struct Student stu[]) {int i;printf ("Çë Ö±ðêäèë¸÷ñ§éúµäðåºñ§ºå£¬ðõãû£¬èýãå¿î³é¼¨\n "); for (i=0;i<n;i++) {scanf ("%d%s%f%f%f ", &stu[i].num,stu[i]. NAME,&STU[I].SOCRE[0],&STU[I].SOCRE[1],&STU[I].SOCRE[2]); Stu[i].aver= (Stu[i].socre[0]+stu[i].socre [1]+stu[i].socre[2])/3;}} struct Student max (struct Student stu[]) {int i,m=0;for (i=0;i<n;i++) if (stu[i].aver>stu[m].aver) M=i;return stu[m ];} void print (struct Student stud) {printf ("\n³é¼¨xî¸ßµäñ§éúê磺\n");p rintf ("ñ§ºå£º%d\nðõãû£º%s\nèýãå¿î³é¼¨£º%5.1f,% 5.1f,%5.1f\næ½¾ù³é¼¨£º%6.2f\n ", stud.num,stud.name,stud.socre[0],stud.socre[1],stud.socre[2],stud.aver);} int main () {struct Student stu[n],*p=stu;input (p);p rint (Max (P)); return 0;}

"C language" has n structure variables, including student number, name and three class results. The information required to output the highest average scores of students.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.