这个我调试通过的,你看看。反正我觉得你格式啥的,不怎么好,以后要注意。
#include"stdio.h"
int main()
{
    struct xj{
        int xh;
        char name[10];
        int zcj;
        struct cj{
            int yw;
            int sx;
            int yy;
        }stu_cj;                                    /*再在结构体里定义一个结构体类型cj,并定义一个结构体变量stu_cj用来存放三门功课成绩*/
    };                                                 /*定义结构体XJ类型*/
    struct xj stu[10];                          /*定义结构体变量stu数组,有10个结构体变量*/
    int i=0,n,max,k;
    printf("请输入你要输入几个同学的成绩\n");
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        printf("请按如下格式输入第%d个同学学号,姓名,语文成绩 数学成绩 英语成绩\n",i+1);
        scanf("%d%s%d%d%d",&stu[i].xh,&stu[i].name,&stu[i].stu_cj.yw,&stu[i].stu_cj.sx,&stu[i].stu_cj.yy);
    }
    for(i=0;i<n;i++)
    {
        stu[i].zcj=stu[i].stu_cj.yw+stu[i].stu_cj.sx+stu[i].stu_cj.yy;
        printf("第%d个同学平均成绩:%d\n",i+1,stu[i].zcj/3);
    }                                            /*计算每个同学的总成绩,然后按平均成绩输出*/
/*    if(n==1)
    {
    printf("学号:%d\n姓名:%s\n三门课成绩:%d %d %d\n平均成绩:%d\n",stu[0].xh,stu[0].name,stu[0].stu_cj.yw,stu[0].stu_cj.sx,stu[0].stu_cj.yy,stu[0].zcj/3);
    }
*/
    max=stu[0].zcj;
    for(i=1;i<n;i++)
    {
        if(max<stu[i].zcj)
        {
            max=stu[i].zcj;
            k=i;
        }                                         /*用K记录成绩最高同学的下标,并在下行输出该同学的所有录入信息*/
    }
    printf("最高成绩学生的学号:%d\n姓名:%s\n三门课成绩:%d %d %d\n平均成绩是:%d\n",stu[k].xh,stu[k].name,stu[k].stu_cj.yw,stu[k].stu_cj.sx,stu[k].stu_cj.yy,stu[k].zcj/3);
    return 0;
}