谁帮我解决下问题。弄不懂了。
程序代码:
#include<stdio.h> #include<string.h> struct student /*定义学生信息*/ {char num; char name[20]; char sex; char major; int chinese; int math; int english; }; struct student str[30],*p; void main() { int com(struct student *score); int i; for(i=0;i<30;i++) /*循环录入学生信息*/ {scanf("%d\n",str[i].num); scanf("%s\n",str[i].name); scanf("%c\n",str[i].sex); scanf("%s\n",str[i].major); scanf("%d\n",str[i].chinese); scanf("%d\n",str[i].math); scanf("%d\n",str[i].english); } p=str; com(p); } int com(int *score) { int a,b,c,d,e,i; a=b=c=d=e=0; for(i=0;i<30;i++) {switch(score[i]->chinese/10) case 0: case 1: case 2: case 3: case 4: case 5:e++;break; case 6:d++;break; case 7:c++;break; case 8:b++;break; case 9: case 10:a++;break; default :printf("error"); printf("不及格:%d\n,及格:%d\n,中:%d\n,良:%d\n,优:%d\n",e,d,c,b,a); } f:\新建文件夹\求和.cpp(35) : error C2227: left of '->chinese' must point to class/struct/union f:\新建文件夹\求和.cpp(42) : error C2046: illegal case f:\新建文件夹\求和.cpp(43) : error C2046: illegal case f:\新建文件夹\求和.cpp(44) : error C2046: illegal case f:\新建文件夹\求和.cpp(45) : error C2046: illegal case f:\新建文件夹\求和.cpp(46) : error C2046: illegal case f:\新建文件夹\求和.cpp(47) : error C2047: illegal default f:\新建文件夹\求和.cpp(50) : fatal error C1004: unexpected end of file found 那个switch的函数有点弄不来了。