欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

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

    • 资源ID:50258639       资源大小:49.90KB        全文页数:18页
    • 资源格式: DOCX        下载积分:20金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要20金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

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

    华北科技学院计算机系综合性实验报告华北科技学院计算机系综合性实验实 验 报 告 课程名称 C语言程序设计 实验学期 2011 至 2012 学年 第 二 学期 学生所在系部 计算机系 年级 2011 专业班级 计算机科学与技术B-111 学生姓名 学号 任课教师 实验成绩 计算机系制实验报告须知1、 学生上交实验报告时,必须为打印稿(A4纸)。页面空间不够,可以顺延。2、 学生应该填写的内容包括:封面相关栏目、实验地点、时间、目的、设备环境、内容、结果及分析等。3、 教师应该填写的内容包括:实验成绩、教师评价等。4、 教师根据本课程的综合性实验指导单中实验内容的要求,评定学生的综合性实验成绩;要求在该课程期末考试前将实验报告交给任课教师。综合性实验中,所涉及的程序,文档等在交实验报告前,拷贝给任课教师。任课教师统一刻录成光盘,与该课程的期末考试成绩一同上交到系里存档。5、 未尽事宜,请参考该课程的实验大纲和教学大纲。C语言程序设计课程综合性实验报告开课实验室:基础五 2012年7月 6 日实验题目基于链表的学生成绩管理系统一、实验目的1、掌握链表的创建、遍历显示和清除; 2、掌握链表数据的文件保存、读取;二、设备与环境 微型计算机、VC+6.0三、实验内容1、定义结构体,创建链表struct xsnode int xh; char xm15; int gs; int yy; int wl; struct xsnode *next;2、根据以上链表结点结构,实现以下功能 a、学生学号、姓名、各门成绩的录入; b、链表数据显示及清除; c、链表数据的文件保存与读取;四、实验结果及分析1、运行结果主菜单数据显示2、源程序 主函数void main() int xz=0; struct xs *head; head=init(); while(xz!=5) menu(); scanf("%d",&xz); switch(xz) case 1: create(head); break;case 2: print(head); break;case 3: save(head); break; case 4: read(head); break; case 5: printf("n 系统退出,拜拜!n "); break;default:printf("n 选择错误,请按任意键选择!n ");getch();break; fr(head); free(head); 数据录入源代码void create(struct xs *hd)int xh,gs,yy,wl,i;char xm20;struct xs *p;fr(hd);printf("n 请输入学生个数:");scanf("%d",&num);for(i=0;i<num;i+)printf("请输入%d个学生 of %dn",i+1,num);printf(" 学号:");scanf("%d",&xh);printf(" 姓名:");scanf("%s",xm);printf(" 高数:");scanf("%d",&gs);printf(" 英语:");scanf("%d",&yy);printf(" 物理:");scanf("%d",&wl);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 print(struct xs *hd) struct xs*p;p=hd->next;if(p!=NULL)printf("n 数据显示n");printf("*n");printf(" 学号 姓名 高数 英语 物理 平均分n");printf("*n");while(p!=NULL)printf("%4d ",p->xh);printf("%10s",p->xm);printf("%8d",p->gs);printf("%7d",p->yy);printf("%6d",p->wl);printf("%8.2fn",(p->wl+p->wl+p->wl)/3.0);p=p->next;printf("*n");printf(" 链表显示完毕,请按任意键继续!n"); getch();elseprintf("n 当前链表为空,请先读取文件或创建链表!n 按任意键继续!n "); 查询记录源代码void menu()system("cls");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:"); 源程序#include"stdio.h"#include"stdlib.h"#include<string.h>#include"conio.h"struct xsint xh;char xm20;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 xm20;struct xs *p;fr(hd);printf("n 请输入学生个数:");scanf("%d",&num);for(i=0;i<num;i+)printf("请输入%d个学生 of %dn",i+1,num);printf(" 学号:");scanf("%d",&xh);printf(" 姓名:");scanf("%s",xm);printf(" 高数:");scanf("%d",&gs);printf(" 英语:");scanf("%d",&yy);printf(" 物理:");scanf("%d",&wl);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("yh.txt","w");fprintf(fp,"%3dn",num);for(i=0;i<num;i+)fprintf(fp,"%3d %12s %3d %3d %3dn",p->xh,p->xm,p->gs,p->yy,p->wl);p=p->next;fclose(fp);printf("n 保存文件完毕,请按任意键继续!n ");getch();elseprintf("n 当前链表为空,不需要保存,请按任意键继续!n ");getch();void read(struct xs *hd)int i;struct xs *p;FILE *fp;fr(hd);fp=fopen("yh.txt","r");fscanf(fp,"%3dn",&num);for(i=0;i<num;i+) p=(struct xs *)malloc(sizeof(struct xs); fscanf(fp,"%3d %12s %3d %3d %3dn",p->xh,p->xm,p->gs,p->yy,p->wl); p->next=hd->next; hd->next=p;fclose(fp);printf("n 读取文件完毕,请按任意键继续!n ");getch();void print(struct xs *hd) struct xs*p;p=hd->next;if(p!=NULL)printf("n 数据显示n");printf("*n");printf(" 学号 姓名 高数 英语 物理 平均分n");printf("*n");while(p!=NULL)printf("%4d ",p->xh);printf("%10s",p->xm);printf("%8d",p->gs);printf("%7d",p->yy);printf("%6d",p->wl);printf("%8.2fn",(p->wl+p->wl+p->wl)/3.0);p=p->next;printf("*n");printf(" 链表显示完毕,请按任意键继续!n"); getch();elseprintf("n 当前链表为空,请先读取文件或创建链表!n 按任意键继续!n ");void menu()system("cls");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("%d",&xz); switch(xz) case 1: create(head); break;case 2: print(head); break;case 3: save(head); break; case 4: read(head); break; case 5: printf("n 系统退出,拜拜!n "); break;default:printf("n 选择错误,请按任意键选择!n ");getch();break; fr(head); free(head);3、试验收获通过这次试验,我掌握了链表的创建、遍历显示和清除功能,掌握了链表数据的文件保存、读取,能够熟练的使用VC+6.0,对C程序有了更深的了解。教 师 评 价评定项目ABCD评定项目ABCD算法正确界面美观,布局合理程序结构合理操作熟练语法、语义正确解析完整实验结果正确文字流畅报告规范题解正确其他:评价教师签名:年 月 日代码:#include"stdio.h"#include"stdlib.h"#include<string.h>#include"conio.h"struct xsint xh;char xm20;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 xm20;struct xs *p;fr(hd);printf("n 请输入学生个数:");scanf("%d",&num);for(i=0;i<num;i+)printf("请输入%d个学生 of %dn",i+1,num);printf(" 学号:");scanf("%d",&xh);printf(" 姓名:");scanf("%s",xm);printf(" 高数:");scanf("%d",&gs);printf(" 英语:");scanf("%d",&yy);printf(" 物理:");scanf("%d",&wl);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("yh.txt","w");fprintf(fp,"%3dn",num);for(i=0;i<num;i+)fprintf(fp,"%3d %12s %3d %3d %3dn",p->xh,p->xm,p->gs,p->yy,p->wl);p=p->next;fclose(fp);printf("n 保存文件完毕,请按任意键继续!n ");getch();elseprintf("n 当前链表为空,不需要保存,请按任意键继续!n ");getch();void read(struct xs *hd)int i;struct xs *p;FILE *fp;fr(hd);fp=fopen("yh.txt","r");fscanf(fp,"%3dn",&num);for(i=0;i<num;i+) p=(struct xs *)malloc(sizeof(struct xs); fscanf(fp,"%3d %12s %3d %3d %3dn",p->xh,p->xm,p->gs,p->yy,p->wl); p->next=hd->next; hd->next=p;fclose(fp);printf("n 读取文件完毕,请按任意键继续!n ");getch();void print(struct xs *hd) struct xs*p;p=hd->next;if(p!=NULL)printf("n 数据显示n");printf("*n");printf(" 学号 姓名 高数 英语 物理 平均分n");printf("*n");while(p!=NULL)printf("%4d ",p->xh);printf("%10s",p->xm);printf("%8d",p->gs);printf("%7d",p->yy);printf("%6d",p->wl);printf("%8.2fn",(p->wl+p->wl+p->wl)/3.0);p=p->next;printf("*n");printf(" 链表显示完毕,请按任意键继续!n"); getch();elseprintf("n 当前链表为空,请先读取文件或创建链表!n 按任意键继续!n ");void menu()system("cls");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("%d",&xz); switch(xz) case 1: create(head); break;case 2: print(head); break;case 3: save(head); break; case 4: read(head); break; case 5: printf("n 系统退出,拜拜!n "); break;default:printf("n 选择错误,请按任意键选择!n ");getch();break; fr(head); free(head);第 17 页

    注意事项

    本文(C语言程序设计-基于链表的学生成绩管理系统.docx)为本站会员(叶***)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开