第一范文网 - 专业文章范例文档资料分享平台

C语言程序设计-基于链表的学生成绩管理系统 (2)

来源:用户分享 时间:2020-06-22 本文由时光清浅 分享 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

华北科技学院计算机系综合性实验报告 { struct xs*p; p=hd->next; if(p!=NULL) { printf(\ 数据显示\\n\ printf(\ printf(\ 学号 姓名 高数 英语 物理 平均分\\n\ printf(\ while(p!=NULL) { printf(\ printf(\ printf(\ printf(\ printf(\ printf(\ p=p->next; } printf(\ printf(\ 链表显示完毕,请按任意键继续!\\n\ getch(); } else printf(\ 当前链表为空,请先读取文件或创建链表!\\n 按任意键继续!\\n \ } ?查询记录源代码 void menu() { system(\ printf(\ ****************************************\\n\ printf(\ * 学生成绩管理系统(1.0) *\\n\ printf(\ ****************************************\\n\ printf(\ * jb11-1 31 宋洁 2012-7-3 *\\n\ printf(\ ****************************************\\n\ printf(\ * 1-创建链表 *\\n\ printf(\ * 2-数据显示 *\\n\ printf(\ * 3-保存文件 *\\n\ printf(\ * 4-读取文件 *\\n\ printf(\ * 5-系统退出 *\\n\ printf(\ ****************************************\\n\ printf(\ 请选择操作(1-5:\

第 5 页

华北科技学院计算机系综合性实验报告 } ?源程序 #include\#include\#include #include\struct xs { int xh; char xm[20]; int gs,yy,wl; struct xs *next; }; int num=0; struct xs *init() { struct xs* hd; hd=(struct xs *)malloc(sizeof(struct xs)); hd->next=NULL; return hd; } void fr(struct xs *hd) { struct xs *p; p=hd->next; while(hd->next!=NULL) { p=hd->next; hd->next=p->next; free(p); } } void create(struct xs *hd) { int xh,gs,yy,wl,i; char xm[20]; struct xs *p; fr(hd); printf(\ 请输入学生个数:\ scanf(\ for(i=0;i

第 6 页

华北科技学院计算机系综合性实验报告 scanf(\ printf(\ 姓名:\ scanf(\ printf(\ 高数:\ scanf(\ printf(\ 英语:\ scanf(\ printf(\ 物理:\ scanf(\ p=(struct xs *)malloc(sizeof(struct xs)); p->xh=xh; strcpy(p->xm,xm); p->gs=gs; p->yy=yy; p->wl=wl; p->next=hd->next; hd->next=p; } printf(\ 录入数据完毕,请按任意键继续!\\n \ getch(); } void save(struct xs *hd) { if(hd->next!=NULL) { struct xs *p=hd->next; int i; FILE *fp; fp=fopen(\ fprintf(fp,\ for(i=0;inext; } fclose(fp); printf(\ 保存文件完毕,请按任意键继续!\\n \ getch(); } else { printf(\ 当前链表为空,不需要保存,请按任意键继续!\\n \

第 7 页

华北科技学院计算机系综合性实验报告 getch(); } } void read(struct xs *hd) { int i; struct xs *p; FILE *fp; fr(hd); fp=fopen(\ fscanf(fp,\ for(i=0;inext=hd->next; hd->next=p; } fclose(fp); printf(\ 读取文件完毕,请按任意键继续!\\n \ getch(); } void print(struct xs *hd) { struct xs*p; p=hd->next; if(p!=NULL) { printf(\ 数据显示\\n\ printf(\ printf(\ 学号 姓名 高数 英语 物理 平均分\\n\ printf(\ while(p!=NULL) { printf(\ printf(\ printf(\ printf(\ printf(\ printf(\ p=p->next; } printf(\

第 8 页

华北科技学院计算机系综合性实验报告 printf(\ 链表显示完毕,请按任意键继续!\\n\ getch(); } else printf(\ 当前链表为空,请先读取文件或创建链表!\\n 按任意键继续!\\n \ } void menu() { system(\ printf(\ ****************************************\\n\ printf(\ * 学生成绩管理系统(1.0) *\\n\ printf(\ ****************************************\\n\ printf(\ * jb11-1 31 宋洁 2012-7-3 *\\n\ printf(\ ****************************************\\n\ printf(\ * 1-创建链表 *\\n\ printf(\ * 2-数据显示 *\\n\ printf(\ * 3-保存文件 *\\n\ printf(\ * 4-读取文件 *\\n\ printf(\ * 5-系统退出 *\\n\ printf(\ ****************************************\\n\ printf(\ 请选择操作(1-5:\ } void main() { int xz=0; struct xs *head; head=init(); while(xz!=5) { menu(); scanf(\ switch(xz) { case 1: create(head); break; case 2: print(head); break; case 3: save(head); break; case 4:

第 9 页

搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新幼儿教育C语言程序设计-基于链表的学生成绩管理系统 (2)全文阅读和word下载服务。

C语言程序设计-基于链表的学生成绩管理系统 (2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/wenku/1095224.html(转载请注明文章来源)
热门推荐
Copyright © 2018-2022 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top