哪位高人帮我改一下代码
//实现简单的学生成绩信息管理软件。 // 学生信息包括:学号、姓名、4门课程的成绩(计算机,数学,英语,物理)。
// 要实现的功能:学生信息的录入、修改、删除和查询。
#include<stdio.h>
int n;
struct student
{
int id;
char name[20];
float com,math,en,phy;
}stu[20];
struct student *a=&stu[0];
void record(struct student *p)
{
int i;
printf("Input the number of students.\n");
scanf("%d",&n);
printf("Input the information of each student.\n");
for(i=0;i<n;i++)
scanf("%d%s%f%f%f%f",&(p+i)->id,(p+i)->name,&(p+i)->com,&(p+i)->math,&(p+i)->en,&(p+i)->phy);
getchar();
}
void correct(struct student *p)
{
int i,b,flag=1;
printf("Input the ID of a student which you want to correct.\n");
scanf("%d",&b);
for(i=0;i<n;i++)
if(b==(p+i)->id)
{
scanf("%d%s%f%f%f%f",&(p+i)->id,(p+i)->name,&(p+i)->com,&(p+i)->math,&(p+i)->en,&(p+i)->phy);
flag=0;
}
if(flag)
printf("No such student.\n");
getchar();
}
void Delete(struct student *p)
{
int i,b,flag=1;
printf("Input the ID of a student you want to delete.\n");
scanf("%d",&b);
for(i=0;i<n;i++)
if(b==(p+i)->id)
{
(p+i)->id='\0';
flag=0;
}
if(flag)
printf("No such student.\n");
getchar();
}
void search(struct student *p)
{
int i,b,flag=1;
printf("Input the ID of a student you want to search.\n");
scanf("%d",&b);
for(i=0;i<n;i++)
if(b==(p+i)->id)
{
printf("%-4d%-10s%-6.1f%-6.1f%-6.1f%-6.1f\n",(p+i)->id,(p+i)->name,(p+i)->com,(p+i)->math,(p+i)->en,(p+i)->phy);
flag=0;
}
if(flag)
printf("No such student.\n");
getchar();
}
int main()
{
char c;
while(1)
{
printf("A record B correct C delete D search E end\n");
scanf("%c",&c);
if(c=='A') record(a);
else if(c=='B') correct(a);
else if(c=='C') Delete(a);
else if(c=='D') search(a);
else if(c=='E') break;
}
return 0;
}
//第二次输入学生数据会把以前的数据覆盖;希望帮我改一下,谢谢!