范文无忧网范文学习范文大全

学生信息管理系统C语言怎么做

01月07日 编辑 fanwen51.com

跟别人问重复了,你们难道是一个老师教的啊? 网上很多类似的,你参考下:#include#includestruct student { char name[30]; float math; float chinese; float english; float average; }; int MenuChoice(void); int EnterAccount(void); void Enter(struct student *fst); void Amend(struct student *src); void Delete(struct student *next); void Print(struct student *out); main() { struct student one[100] = , *look = one; int menu, t; while ((menu = MenuChoice()) != 0) if (menu >= 1 & menuname, "")) printf("学号:%d\n姓名: %s\n语文成绩: %.1f\n数学成绩:%.1f\n英语成绩: %f\n平均"成绩:%.1f\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 MenuChoice(void) { int choice; printf("请选择:\n" "1 - 新建学生信息\n" "2 - 查找学生信息\n" "3 - 修改学生信息\n" "4 - 删除学生信息\n" "5 - 打印学生信息\n" "0 - 退出\n"); scanf("%d", &choice); return choice; } int EnterAccount(void) { int ret; printf("请输入学号:\n"); scanf("%d", &ret); if (ret >= 1 & retname, &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("请输入学生新的语文成绩\n"); 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; outname, "")) printf("学号:%d\n姓名: %s\n语文成绩: %.1f\n数学成绩:%.1f\n英语成绩: %.1f\n平均成绩:%.1f\n", out-up + 1, out->name, out->chinese, out->math, out->english, out->average); }

推荐阅读
图文推荐
栏目列表