哪位高手帮忙修改下 关于学生操作系统的 谢谢!
#include <stdio.h>#include <string.h>
class student
{
char name[30];
float math;
float chinese;
float english;
float average;
}one[100];
int MenuChoice(int);
int EnterAccount(int);
void Enter( student *fst);
void Amend( student *src);
void Delete( student *next);
void print( student *out);
main()
{
student one[100]={0},*look=one;
int menu,t;
while((menu=MenuChioce())!=0)
if(menu>1 && menu<=4 && (t=EnterAccount()))
{
look=one+t;
switch(menu)
{
case 1:
Enter(look);
break;
case 2:
if (strcmp(look->name,""))
printf("学号:%d\n姓名: %s\n语文成绩: %f\n数学成绩:%f\n英语成绩: %f\n平均成绩:%f\n",t, look->name, look->chinese, look->math, look->english, look->average);
else
printf("对不起,该学号不存在!\n");
break;
case 3:
Amend(look);
break;
case 4:
Delete(look);
break;
}
}
else if(menu==5)
print(one);
else
printf("错误的请求!\n");
return 0;
}
int MenuChioce(int)
{
int choice;
printf("请选择:\n"
"1 - 新建学生信息\n"
"2 - 查找学生信息\n"
"3 - 修改学生信息\n"
"4 - 删除学生信息\n"
"5 - 打印学生信息\n"
"0 - 退出\n");
scanf("%d",&choice);
return choice;
}
int EnterAccount(int)
{
int ret;
printf("请输入学号:\n");
scanf("%d",&ret);
if(ret>=1 && ret<=100)
return ret-1;
return 0;
}
void Enter(struct student *fst)
{
printf("请输入学生姓名、语文成绩、数学成绩、英语成绩和平均成绩\n");
scanf("%s%f%f%f",*fst->name,&fst->chinese,&fst->math,&fst->english,&fst->average);
}
void Amend(struct student &src)
{
int t;
printf("请选择:\n"
"1 - 修改学生姓名\n"
"2 - 修改学生语文成绩\n"
"3 - 修改学生数学成绩\n"
"4 - 修改学生英语成绩\n"
"5 - 修改学生平均成绩\n");
scanf("%d",&t);
switch(t)
{
case 1:
printf("请输入学生的新名字\n");
scanf("%s",&src->name);
break;
case 2:
printf("请输入学生新的语文成绩");
scanf("%f",&src->chinese);
break;
case 3:
printf("请输入学生新的数学成绩\n");
scanf("%f",&src->math);
break;
case 4:
printf("请输入学生新的英语成绩\n");
scanf("%f",&src->english);
break;
case 5:
printf("请输入学生新的平均成绩\n");
scanf("%f",&src->average);
break;
}
}
void Delete(struct student *next)
{
strcpy(next->name,"");
next->math = next->english = next->chinese = next->average = 0.0;
}
void print(struct student *out)
{
struct student *up;
for(up = out;out < &up[100]; out++)
if(strcmp(out->name,""))
printf("学号:%d\n姓名: %s\n语文成绩: %f\n数学成绩:%f\n英语成绩: %f\n平均成绩:%f\n",
out-up + 1,out->name,out->chinese,out->math;out->english, out->average);
}