帮们看看这段C的代码 实在不知道怎么改了~

#include<stdio.h>

typedef struct STU
{
    char num[7];
    char name[16];
    struct DATE
    {
        int year;
        int month;
        int day;
    }birthday;
    struct RECORD
    {
        int a;
        int b;
        int c;
        int d;
    }record;
}stu;

void main()
{

int n,i;

scanf("%d",&n);


for(i = 0; i < n; i++)
{    
    scanf("%s %s %d%d%d %d%d%d",&stu[i].num,&stu[i].name,&stu[i].birthday.year,&stu[i].birthday.month,&stu[i].birthday.day,&stu[i].record.a,&stu[i].record.b,&stu[i].record.c);
/*    scanf("%s",&stu[i].name);
    scanf("%d%d%d",&stu[i].birthday.year,&stu[i].birthday.month,&stu[i].birthday.day);
    scanf("%d%d%d",&stu[i].record.a,&stu[i].record.b,&stu[i].record.c);*/
}

int rr[n];

for(i = 0; i < n; i++)
{
    rr[i] = a*0.2 + b*0.3 + c*0.5;
}

printf("num       name      birthday    s1  s2  s3  sum\n");

for(i=0 ; i<n; i++)
{
    printf("%-10s",stu[i].num);
    printf("%-10s",stu[i].name);
    printf("%d/%2d/%-4d",stu[i].birthday.year,stu[i].birthday.month,stu[i].birthday.day);
    printf("%-4d\n",rr[i]);
}

}

错误信息如下;
T.CPP
e:\c\l\t.cpp(33) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(33) : error C2228: left of '.num' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(33) : error C2228: left of '.name' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(33) : error C2228: left of '.birthday' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2228: left of '.year' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(33) : error C2228: left of '.birthday' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2228: left of '.month' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(33) : error C2228: left of '.birthday' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2228: left of '.day' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(33) : error C2228: left of '.record' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2228: left of '.a' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(33) : error C2228: left of '.record' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2228: left of '.b' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(33) : error C2228: left of '.record' must have class/struct/union type
e:\c\l\t.cpp(33) : error C2228: left of '.c' must have class/struct/union type
e:\c\l\t.cpp(39) : error C2057: expected constant expression
e:\c\l\t.cpp(39) : error C2466: cannot allocate an array of constant size 0
e:\c\l\t.cpp(39) : error C2133: 'rr' : unknown size
e:\c\l\t.cpp(43) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
e:\c\l\t.cpp(50) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(50) : error C2228: left of '.num' must have class/struct/union type
e:\c\l\t.cpp(51) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(51) : error C2228: left of '.name' must have class/struct/union type
e:\c\l\t.cpp(52) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(52) : error C2228: left of '.birthday' must have class/struct/union type
e:\c\l\t.cpp(52) : error C2228: left of '.year' must have class/struct/union type
e:\c\l\t.cpp(52) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(52) : error C2228: left of '.birthday' must have class/struct/union type
e:\c\l\t.cpp(52) : error C2228: left of '.month' must have class/struct/union type
e:\c\l\t.cpp(52) : error C2275: 'stu' : illegal use of this type as an expression
e:\c\l\t.cpp(20) : see declaration of 'stu'
e:\c\l\t.cpp(52) : error C2228: left of '.birthday' must have class/struct/union type
e:\c\l\t.cpp(52) : error C2228: left of '.day' must have class/struct/union type
执行 cl.exe 时出错.

修改如下,供参考:

#include<stdio.h>
typedef struct STU
{
    char   num[7];
    char   name[16];
    struct DATE
    {
        int year;
        int month;
        int day;
    }birthday;
    struct RECORD
    {
        int a;
        int b;
        int c;
        int d;
    }record;
}Stu;

Stu stu[100];

int  main()
{
    int n,i;
    scanf("%d",&n);

    for(i = 0; i < n; i++)
    {
        scanf("%s%s%d%d%d%d%d%d",stu[i].num,stu[i].name,&stu[i].birthday.year,
        &stu[i].birthday.month,&stu[i].birthday.day,&stu[i].record.a,&stu[i].record.b,
        &stu[i].record.c);
        //scanf("%s",&stu[i].name);
        //scanf("%d%d%d",&stu[i].birthday.year,&stu[i].birthday.month,&stu[i].birthday.day);
        //scanf("%d%d%d",&stu[i].record.a,&stu[i].record.b,&stu[i].record.c);
    }
    //int rr[n];
    int *rr = new int[n];
    for(i = 0; i < n; i++)
    {
        //rr[i] = a*0.2 + b*0.3 + c*0.5;
        rr[i] = stu[i].record.a*0.2 + stu[i].record.b*0.3 + stu[i].record.c*0.5;
    }
    printf("num       name      birthday    s1  s2  s3  sum\n");
    for(i=0 ; i<n; i++)
    {
        printf("%-10s",stu[i].num);
        printf("%-10s",stu[i].name);
        printf("%d/%2d/%-4d",stu[i].birthday.year,stu[i].birthday.month,stu[i].birthday.day);
        printf("%-4d\n",rr[i]);
    }
    
    return 0;
}

至少你要说下,错误信息
或者没错误但输出不是预期

scanf("%s %s %d%d%d %d%d%d",&stu[i].num,&stu[i].name,&stu[i].birthday.year,&stu[i].birthday.month,&stu[i].birthday.day,&stu[i].record.a,&stu[i].record.b,&stu[i].record.c);

stu[i]
你只有一个stu,并不存在stu[i]

typedef struct STU
{
    char num[7];
    char name[16];
    struct DATE
    {
        int year;
        int month;
        int day;
    }birthday;
    struct RECORD
    {
        int a;
        int b;
        int c;
        int d;
    }record;
}stu[100];//定义100个stu看看吧