注册 登录
编程论坛 C++教室

提示有一个错误,找不到?

w天然呆x 发布于 2013-05-22 14:23, 1179 次点击
#include<stdio.h>
int main()
{
   
    printf("                   MENU                 \n");
    printf("=========================================\n");
    printf("1.input the students'nameS and scores\n");
    printf("2.search scores of some students\n");
    printf("3.modify scores of some students\n");
    printf("4.list all students'scores\n");
    printf("5.quit the system\n");
    printf("=========================================\n");
    int i,j;
    char name[20]char id[20];int ENGLISH[5]int math[5]int chinese[5];
    printf("please input your choice(1-5):");
    scanf("%d",&i);
    switch(i)
    {
    case 1:printf("===MENU 1.input the students'nameS and scores===\n===  please input the students'information  ===\n");
        printf("name:");
        for(j=0;j<20;j++)
            scanf("%c",&name[j]);
        printf("\nid:");
        for(j=0;j<20;j++)
            scanf("%c",&id[j]);
        printf("\nENGLISH:");
        for(j=0;j<5;j++)
            scanf("%d",&ENGLISH[J]);
        printf("\nmath:");
        for(j=0;j<5;j++)
            scanf("%d",&math[j]);
        printf("\nchinese:");
        for(j=0;j<5;j++)
            scanf("%d",&chinese[j]);
        printf("\n");
        break;
    case 4:printf("===MENU 4.list all students'scores===\n");
        for(j=0;j<20;j++)
            printf("%c\n",name[j]);
        for(j=0;j<20;j++)
            printf("%c\n",id[j]);
        for(j=0;j<5;j++)
            printf("%d\n",ENGLISH[J]);
        for(j=0;j<5;j++)
            printf("%d\n",math[j]);
        for(j=0;j<5;j++)
            printf("%d\n",chinese[j]);


    }
}
7 回复
#2
rjsp2013-05-22 14:26
先别忙,先学会怎么提问题吧

char name[20]char id[20];int ENGLISH[5]int math[5]int chinese[5];
编译器报错:error C2144: syntax error : 'char' should be preceded by ';'

for(j=0;j<5;j++)
    scanf("%d",&ENGLISH[J]);
编译器报错:'J' : undeclared identifier
#3
w天然呆x2013-05-22 14:58
提示有一个错误,可是下面却列出来了不下二十个error,我也是木办法!
#4
w天然呆x2013-05-22 15:00
这是编译器报的错--------------------Configuration: dfdgd - Win32 Debug--------------------
Compiling...
1.c
F:\dfdgd\1.c(13) : error C2143: syntax error : missing ';' before 'type'
F:\dfdgd\1.c(14) : error C2143: syntax error : missing ';' before 'type'
F:\dfdgd\1.c(14) : error C2143: syntax error : missing ';' before 'type'
F:\dfdgd\1.c(16) : error C2065: 'i' : undeclared identifier
F:\dfdgd\1.c(22) : error C2065: 'name' : undeclared identifier
F:\dfdgd\1.c(22) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(22) : error C2102: '&' requires l-value
F:\dfdgd\1.c(25) : error C2065: 'id' : undeclared identifier
F:\dfdgd\1.c(25) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(25) : error C2102: '&' requires l-value
F:\dfdgd\1.c(28) : error C2065: 'ENGLISH' : undeclared identifier
F:\dfdgd\1.c(28) : error C2065: 'J' : undeclared identifier
F:\dfdgd\1.c(28) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(28) : error C2102: '&' requires l-value
F:\dfdgd\1.c(31) : error C2065: 'math' : undeclared identifier
F:\dfdgd\1.c(31) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(31) : error C2102: '&' requires l-value
F:\dfdgd\1.c(34) : error C2065: 'chinese' : undeclared identifier
F:\dfdgd\1.c(34) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(34) : error C2102: '&' requires l-value
F:\dfdgd\1.c(39) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(41) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(43) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(45) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(47) : error C2109: subscript requires array or pointer type
执行 cl.exe 时出错.

1.obj - 1 error(s), 0 warning(s)
#5
peach54602013-05-22 21:38
以下是引用w天然呆x在2013-5-22 15:00:02的发言:

这是编译器报的错--------------------Configuration: dfdgd - Win32 Debug--------------------
Compiling...
1.c
F:\dfdgd\1.c(13) : error C2143: syntax error : missing ';' before 'type'
F:\dfdgd\1.c(14) : error C2143: syntax error : missing ';' before 'type'
F:\dfdgd\1.c(14) : error C2143: syntax error : missing ';' before 'type'
F:\dfdgd\1.c(16) : error C2065: 'i' : undeclared identifier
F:\dfdgd\1.c(22) : error C2065: 'name' : undeclared identifier
F:\dfdgd\1.c(22) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(22) : error C2102: '&' requires l-value
F:\dfdgd\1.c(25) : error C2065: 'id' : undeclared identifier
F:\dfdgd\1.c(25) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(25) : error C2102: '&' requires l-value
F:\dfdgd\1.c(28) : error C2065: 'ENGLISH' : undeclared identifier
F:\dfdgd\1.c(28) : error C2065: 'J' : undeclared identifier
F:\dfdgd\1.c(28) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(28) : error C2102: '&' requires l-value
F:\dfdgd\1.c(31) : error C2065: 'math' : undeclared identifier
F:\dfdgd\1.c(31) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(31) : error C2102: '&' requires l-value
F:\dfdgd\1.c(34) : error C2065: 'chinese' : undeclared identifier
F:\dfdgd\1.c(34) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(34) : error C2102: '&' requires l-value
F:\dfdgd\1.c(39) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(41) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(43) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(45) : error C2109: subscript requires array or pointer type
F:\dfdgd\1.c(47) : error C2109: subscript requires array or pointer type
执行 cl.exe 时出错.

1.obj - 1 error(s), 0 warning(s)

2楼的提示不是很明显了吗?
你还有什么不懂的?
#6
邓士林2013-05-22 21:50
都那么多啊
#7
w天然呆x2013-05-22 22:37
jhkl
#8
pangding2013-05-28 13:09
以下是引用w天然呆x在2013-5-22 22:37:17的发言:

jhkl

看见 jkhl 的总觉得是 vi 党。
1