C语言编程时的错误0
dsfsbhdff2014.03.30浏览38次分享举报
#include
typedef struct Student {
int num;
char name[20];
int score;
}STU;
void main()
{
int i,j;double av;
STU a[3];
for(i=0;i<3;i++)
scanf("%d%s%d",&a[i].num,&a[i].name[20],&a[i].score);
av=(a[0].num+a[1].num+a[2].num)*1.0/3;
if(a[0].score>a[1].score)
{if(a[0].score>a[2].score)
{a[0].score=a[0].score;j=0;}else{a[0].score=a[2].score;j=2;}}
else
if(a[1].score>a[2].score){a[0].score=a[1].score;j=1;}else
{a[0].score=a[2].score;j=2;}};
printf("The average score=%.2f\n",av);
printf("The student who has the highest score is:\n");
printf("%d %c %d",a[j].num,a[j].name[20],a[0].score);
}
C:\Users\asus\Desktop\C\新建文件夹\4.c(21) : error C2143: syntax error : missing ')' before 'string'
C:\Users\asus\Desktop\C\新建文件夹\4.c(21) : error C2143: syntax error : missing '{' before 'string'
C:\Users\asus\Desktop\C\新建文件夹\4.c(21) : error C2059: syntax error : ''
C:\Users\asus\Desktop\C\新建文件夹\4.c(21) : error C2059: syntax error : ')'
C:\Users\asus\Desktop\C\新建文件夹\4.c(22) : error C2143: syntax error : missing ')' before 'string'
C:\Users\asus\Desktop\C\新建文件夹\4.c(22) : error C2143: syntax error : missing '{' before 'string'
C:\Users\asus\Desktop\C\新建文件夹\4.c(22) : error C2059: syntax error : ''
C:\Users\asus\Desktop\C\新建文件夹\4.c(23) : error C2059: syntax error : ''
C:\Users\asus\Desktop\C\新建文件夹\4.c(23) : error C2059: syntax error : ')'
C:\Users\asus\Desktop\C\新建文件夹\4.c(31) : error C2059: syntax error : '}'
执行 cl.exe 时出错.
小弟初学C语言 诸多错误还请大神赐教! 这到底是怎么回事啊。。。完全看不懂