我是C语言新手,刚学不久,可以帮帮我看看这程序吗?
学生成绩管理系统: 对学生的成绩信息进行管理,学生信息包括:学号、姓名、学期、每门课程的成绩、平均成绩、名次。实现:学生信息的录入;修改;删除和查询,按学期、学号、成绩不及格等查询。我自己编这个编个一个下午了,我辛勤的汗水啊!!!最后才发现一大堆错误,就是不会改,哪位好心人能帮帮我?居然连结构体声明那里也说我错了?
#include <stdio.h>
#include <string.h>
void menu(void)
{
printf("1. information input\n");
printf("2. information revise\n");
printf("3. information delete\n");
printf("4. information search\n");
printf("Please enter your choice:");
}
main()
{
int a, i, j;
char c;
struct STUDENT
{
int num;
char name[10];
int term;
int scoreMath;
int scoreEnglish;
int scoreChinese;
float average;
int sum;
};
printf("please enter student number:");
scanf("%d",&a);
struct STUDENT stu[a];
4: menu();
c=getchar();
switch(c)
{
case '1':
struct STUDENT abc;
printf("please enter student num:");
for(i=0;i<a;i++)
{
scanf("%d", &stu[i].num);
}
printf("please enter student name:");
for(i=0;i<a;i++)
{
scanf("%s", stu[i].name);
}
printf("please enter term:");
for(i=0;i<a;i++)
{
scanf("%d", &stu[i].term);
}
printf("please enter student scoreMath:");
for(i=0;i<a;i++)
{
scanf("%d", &stu[i].scoreMath);
}
printf("please enter student scoreEnglish:");
for(i=0;i<a;i++)
{
scanf("%d", &stu[i].scoreEnglish);
}
printf("please enter student scoreChinese:");
for(i=0;i<a;i++)
{
scanf("%d", &stu[i].scoreChinese);
}
for(i=0;i<a;i++)
{
stu[i].sum=stu[i].scoreMath+stu[i].scoreEnglish+stu[i].scoreChinese;
stu[i].average=stu[i].sum/4;
}
for(i=0;i<a-1;i++)
{
for(j=i+1;j<a;j++)
{
if(stu[j].sum > stu[i].sum)
{
abc=stu[i];
stu[i]=stu[j];
stu[j]=abc;
}
}
}
for(i=0;i<a;i++)
{
printf("NO. : %d Name : %s Term : %d ScoreMath : %d ScoreEnglish : %d ScoreChinese : %d Sum : %d Average : %f Place: %d ", stu[i].num, stu[i].name, stu[i].term, stu[i].scoreMath, stu[i].scoreEnglish, stu[i].scoreChinese, stu[i].sum, stu[i].average, i+1 );
}
goto 4;
break;
case '2':
int c;
char p;
printf("please enter student num:");
scanf("%d", &c);
printf("please choice the error:");
printf("1. num\n");
printf("2. name\n");
printf("3. term\n");
printf("4. scoreMath\n");
printf("5. scoreEnglish:");
printf("6. scoreChinese:");
printf("Please enter your choice:");
p=getchar();
switch(p)
{
case '1':
printf("please enter the new one:")
scanf("%d", &stu[c].num);
break;
case '2':
printf("please enter the new one:")
scanf("%d", stu[c].name);
break;
case '3':
printf("please enter the new one:")
scanf("%d", &stu[c].term);
break;
case '4':
printf("please enter the new one:")
scanf("%d", &stu[c].scoreMath);
break;
case '5':
printf("please enter the new one:")
scanf("%d", &stu[c].scoreEnglish);
break;
case '6':
printf("please enter the new one:")
scanf("%d", &stu[c].scoreChinese);
break;
default:
printf("Input error!");
}
for(i=0;i<a;i++)
{
stu[i].sum=stu[i].scoreMath+stu[i].scoreEnglish+stu[i].scoreChinese;
stu[i].average=stu[i].sum/4;
}
for(i=0;i<a-1;i++)
{
for(j=i+1;j<a;j++)
{
if(stu[j].sum > stu[i].sum)
{
abc=stu[i];
stu[i]=stu[j];
stu[j]=abc;
}
}
}
for(i=0;i<a;i++)
{
printf("NO. : %d Name : %s Term : %d ScoreMath : %d ScoreEnglish : %d ScoreChinese : %d Sum : %d Average : %f Place: %d ", stu[i].num, stu[i].name, stu[i].term, stu[i].scoreMath, stu[i].scoreEnglish, stu[i].scoreChinese, stu[i].sum, stu[i].average, i+1 );
}
goto 4;
break;
case '3':
int d;
printf("Please enter the delete number:");
scanf("%d", &d);
for(i=0;i<a;i++)
{
if(d==stu[i].num)
{
for(i=0;i<a-1;i++)
{
stu[i]=stu[i+1];
}
goto 1;
}
}
1: for(i=0;i<a-1;i++)
{
printf("NO. : %d Name : %s Term : %d ScoreMath : %d ScoreEnglish : %d ScoreChinese : %d Sum : %d Average : %f Place: %d ", stu[i].num, stu[i].name, stu[i].term, stu[i].scoreMath, stu[i].scoreEnglish, stu[i].scoreChinese, stu[i].sum, stu[i].average, i+1 );
}
goto 4;
break;
case '4':
char u;
printf("please choice the information your want to search:");
printf("1. num\n");
printf("2. name\n");
printf("Please enter your choice:");
u=getchar();
switch(u)
{
case '1':
int e;
printf("Please enter the number:");
scanf("%d", &e);
for(i=0;i<a;i++)
{
if(e==stu[i].num)
{
printf("NO. : %d Name : %s Term : %d ScoreMath : %d ScoreEnglish : %d ScoreChinese : %d Sum : %d Average : %f Place: %d ", stu[i].num, stu[i].name, stu[i].term, stu[i].scoreMath, stu[i].scoreEnglish, stu[i].scoreChinese, stu[i].sum, stu[i].average, i+1 );
goto 2;
}
}
2: break;
case '2':
char mm[10]:
printf("Please enter the name:");
scanf("%s", mm);
for(i=0;i<a;i++)
{
if(strcmp(mm, stu[i].name) == 0 )
{
printf("NO. : %d Name : %s Term : %d ScoreMath : %d ScoreEnglish : %d ScoreChinese : %d Sum : %d Average : %f Place: %d ", stu[i].num, stu[i].name, stu[i].term, stu[i].scoreMath, stu[i].scoreEnglish, stu[i].scoreChinese, stu[i].sum, stu[i].average, i+1 );
goto 3;
}
}
3: break;
default:
printf("Input error!");
}
goto 4;
break;
default:
printf("Input error!");
goto 4;
}
}