#include <stdio.h>
#include <string.h>
#define N 3
struct date
{
int year;
int month;
int day;
};
struct student
{
Char num[6];
char name [10];
float score[3];
float AVR;
char sex;
struct date bir;
} Stu[n];
int main ()
{
int I,j,maxi;
float Sum,max,average;
for (int i=0; i<n; i++)
{
printf ("Input scores ofthe no.%dstudent\n", i+1);
printf ("No.:");
scanf ("%s", &stu[i].num);
printf ("Name:");
scanf ("%s", stu[i].name);
GetChar ();
printf ("Sex:");
scanf ("%c", &stu[i].sex);
printf ("Date:");
scanf ("%d-%d-%d", &stu[i].bir.year,&stu[i].bir.month,&stu[i].bir.day);
for (int j=0; j<3; j + +)
{
printf ("Score%d:", j+1);
scanf ("%f", &stu[i].score[j]);
}
}
average=0;
max=0;
maxi=0;
for (int i=0; i<n; i++)
{
sum=0;
for (int j=0; j<3; j + +)
SUM=SUM+STU[I].SCORE[J];
stu[i].avr=sum/3.0;
AVERAGE+=STU[I].AVR;
if (Sum>max)
{
Max=sum;
Maxi=i;
}
}
Average/=n;
printf ("No. Name Score1 score2 score3 sex Date average\n ");
for (int i=0; i<n; i++)
{
printf ("%-5s%-10s", stu[i].num,stu[i].name);
for (int j=0; j<3; j + +)
{
printf ("%7.2f", Stu[i].score[j]);
}
printf ("%4c%d-%d-%d", stu[i].sex,stu[i].bir.year,stu[i].bir.month,stu[i].bir.day);
printf ("%5.2f\n", STU[I].AVR);
}
printf ("%7.2f\n", average);
printf ("The student is number:%s Name:%s Sex:%c Birthday:%d-%d-%d\n", Stu[maxi].num,stu[maxi].name,stu[maxi].sex,stu[maxi]. Bir.year,stu[maxi].bir.month,stu[maxi].bir.day);
printf ("His score is%5.2f%5.2f%5.2faverage:%5.2f\n", Stu[maxi].score[1],stu[maxi].score[2],stu[maxi].score[3], STU[MAXI].AVR);
return 0;
}
Structure output in tabular form