已帮你改好
#include
#define MAX 100
struct Student
{
char name[20];
int number;
int s[3];
int average;
};struct Student stu[MAX];
int main()
{
int n,i,j,m,max;
printf("请输入人数:");
scanf("%d",&n);
printf("请依次输入每个学生的姓名、学号、及三门课成绩:\n");
for(i=0;i
printf("请输入第%d人的数据:\n",i+1);
scanf("%s%d",stu[i].name,&stu[i].number);
for(j=0;j<3;j++)
scanf("%d",&stu[i].s[j]);//========================这里加个&
printf("/n");
}
for(i=0;i
printf("%s%d",stu[i].name,stu[i].number);
for(j=0;j<3;j++)
printf("%d",stu[i].s[j]);
printf("\n");
}
for(i=0;i
stu[i].average=0;
for(j=0;j<3;j++)
stu[i].average+=stu[i].s[j];
stu[i].average=stu[i].average/3;
}
max=stu[0].average=0;
for(i=0;i
{
max=stu[i].average;
m=i;
}
printf("平均分最高同学数据:\n");
printf("%s%d%d%d%d%d%d",stu[i].name,stu[i].number,stu[i].s[1],stu[i].s[2],stu[i].s[3],stu[i].average);
return 0;
}
希望回答能帮到你,望采纳!
#include
#define MAX 100
struct Student
{
char name[20];
int num;
int score[3];
}boy1,boy2;
int main()
{
int n,i,x=0,y=0,z=0;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d%s%d%d%d",&boy1.num,&boy1.name,&boy1.score[0],&boy1.score[1],&boy1.score[2]);
if(boy1.score[0]+boy1.score[1]+boy1.score[2]>boy2.score[0]+boy2.score[1]+boy2.score[2]||i==1)
boy2=boy1;
x+=boy1.score[0];
y+=boy1.score[1];
z+=boy1.score[2];
}
printf("%d %d %d\n%d %s %d %d %d",x/n,y/n,z/n,boy2.num,boy2.name,boy2.score[0],boy2.score[1],boy2.score[2]);
return 0;
}
#include
#define MAX 100
struct Student
{
char name[20];
int number;
float s[3];
float average;
char c[20];
};struct Student stu[MAX];
int main()
{
int n,i,j,m,max;
scanf("%d",&n);
for(i=0;i
scanf("%s%s%d",stu[i].name,stu[i].c,&stu[i].number);
for(j=0;j<3;j++)
scanf("%f",&stu[i].s[j]);
}
for(i=0;i
stu[i].average=0;
for(j=0;j<3;j++)
stu[i].average+=stu[i].s[j];
stu[i].average=stu[i].average/3;
}
for(i=0;i
printf("%s %.1f",stu[i].name,stu[i].average);
printf("\n");
}
for(i=0;i
stu[i].average=0;
for(j=0;j<3;j++)
stu[i].average+=stu[i].s[j];
stu[i].average=stu[i].average/3;
}
max=stu[0].average=0;
for(i=0;i
{
max=stu[i].average;
m=i;
}
printf("%d %s %s %.1f %.1f %.1f %.1f\n",stu[m].number,stu[m].c,stu[m].name,stu[m].s[0],stu[m].s[1],stu[m].s[2],stu[m].average);
return 0;
}