c语言学生成员管理代码报告怎么写,C语言学生通信录管理系统课程设计报告

《C语言学生通信录管理系统课程设计报告》由会员分享,可在线阅读,更多相关《C语言学生通信录管理系统课程设计报告(18页珍藏版)》请在人人文库网上搜索。

1、实验名称 :学生通信录管理系统 实验项目性质:综合性、设计性所涉及课程:C语言课程设计计划学时:实验学时 4一、实验目的综合考察学生本学期对 C语言的掌握程度。二、实验内容1. 编写一个可以把学生信息写入文件的函数 creact (),采用动 态链表。2. 编写一个可以增加新成员的函数 add1()。3 编写一个可以查询确定学生的函数 search1 ()。4 编写一个可以删除确定学生的函数 del1 ()。5 编写一个可以修改确定学生的函数 modify1 ()。6 编写一个可以打开通信录的函数 open1( ) 。附录: search1 函数调用 searchnum 和 searchnam。

2、e 函数,分别 为按学号和按名字查询。del 函数调用 delname 和 deltel 函数,分别为按名字和 按电话删除。modify1 函数调用 modifynum 和 modifyname 函数, 分别为 按学号和按名字找到修改。open1 函数调用 sorttel 和 sortname 函数,分别为按电话和按 名字从小到大的顺序打开。三、实验(设计)仪器设备和材料清单1.硬件:PC机2. 软件: Turbo C Turbo C+四、实验要求设计一个学生通讯录管理系统 ,在动态链表程序的基础上,设计要求如下(必须使用结构体和动态链表等数据结构)1 建立文件存储文件使用指定文件名或默认文件。

3、名;可以不保存输入记录,但需要确认是否保存输入记录如果已有文件,只能在其后追加;新增记录可以不存入原文件中, 以可以用原来的文件覆盖内存的内 容;可以将多个个文件记录合并到一个文件中;2 文件的存取和显示可以单独存取文件;可以随时显示内存中记录的全部内容;可以直接存取默认文件或指定文件;3 删除记录可以按“姓名”或“电话”方式删除记录并更新内存链表内容;能给出被删除的信息,输出没有找到的信息;如果已经是空表,上出时应给出信息并返回主菜单;如果没有要删除的信息,输出没有找到的信息;删除操作仅限于内存,只有执行记录时,才能覆盖原记录;4查询记录可以按“姓名”或“电话”或“宿舍”方式查询记录能给出查。

4、询记录的信息;如果查询的信息不存在,输出没有找到的信息;5整体功能a可以随时检索、删除、或增加新记录,保存或取消新的记录b使姓名可由16位字符和数字的混合编码组成c使电话号码可由18位字符和数字组成d将输出信息加上输出信息信息栏,例如姓名 电话性别年龄生日宿舍李四1234 男 217 月1日 东二333e使用菜单实现功能的正确的选择f所有节点信息都是动态生成。6测试程序应列出测试大纲对程序进行测试;应保证测试用例测试到程序的各种边缘情况五、实验步骤及结果测试A、主函数主函数提供可选择的功能1234560创建增加查找删除修改打开退出按名字、按学号按电话、按名字按名字、按学号按电话、按名字程序清单。

5、:void mai n()int i;end:printf(I|n);prin tf(| new file|n);printf(|in formatio n|n);prin tf(|n);printf( “|n);prin tf(|n);prin tf(|n);prin tf(|n);prin tf(|n);printf(input your choice(0-6):n); scanf(%d,&i);if(i=1)creat1(); goto end;if(i=2)add1(); goto end;if(i=3)search1(); goto end;if(i=4)del1(); goto e。

6、nd;if(i=5)modify1(); goto end;if(i=6)open1(); goto end;exit(0);B、创建: void create。程序清单:void creat1()FILE *fp;char i;struct student *p1,*p2,*head;n=0;p1=p2=(struct student *)malloc(LEN);printf(nenter NO.:n);scanf(%d,&p1-num);while(p1-num!=0)printf(enter name:n);scanf(%s,p1-name);printf(enter tel:n);sc。

7、anf(%s,p1-tel);doprintf(enter sex:n);getchar();scanf(%c,&p1-sex);while(p1-sex!=f&p1-sex!=F&p1-sex!=m&p1- sex!=M);doprintf(enter age:n);scanf(%d,&p1-age);while(p1-ageage=150);printf(enter birthday:n); scanf(%s,p1-bir);printf(enter address:n);scanf(%s,p1-add);n=n+1;if(n=1)head=p1;else p2-next=p1;p2=p1。

8、;p1=(struct student *)malloc(LEN);printf(enter NO.:n); scanf(%d,&p1-num);p2-next=NULL; printf(nsave them or no(y/n)n); doprintf(input choicen);getchar();scanf(%c,&i);while(i!=y&i!=Y&i!=n&i!=N); if(i=y|i=Y)p1=head;if(fp=fopen(FILENAME,wb)=NULL) printf(cannot open filen); return; if(p1!=NULL) do if(fw。

9、rite(p1,sizeof(struct student),1,fp)!=1) printf(file write errorn); fclose(fp);break; p1=p1-next;while(p1!=NULL); fclose(fp);C、增加 void addl ()设计思路和创建新通信录一样,只是文件的打开方式是“a”,即以追加的方式打开。程序清单:void add1()FILE *fp;char i;struct student *p1,*p2,*head;n=0;p1=p2=(struct student *)malloc(LEN); printf(nenter NO.:。

10、n);scanf(%d,&p1-num);while(p1-num!=0)printf(enter name:n);scanf(%s,p1-name);printf(enter tel:n);scanf(%s,p1-tel);printf(enter sex:n); getchar();scanf(%c,&p1-sex);printf(enter age:n);scanf(%d,&p1-age);printf(enter birthday:n);scanf(%s,p1-bir);printf(enter address:n);scanf(%s,p1-add);n=n+1;if(n=1)head。

11、=p1;else p2-next=p1;p2=p1;p1=(struct student *)malloc(LEN);printf(enter NO.:n);scanf(%d,&p1-num);p2-next=NULL; printf(nsave them or no(y/n)n); doprintf(input choicen);getchar();scanf(%c,&i);while(i!=y&i!=Y&i!=n&i!=N); if(i=y|i=Y)p1=head;if(fp=fopen(FILENAME,a)=NULL)printf(cannot open filen); return;。

12、if(p1!=NULL)doif(fwrite(p1,sizeof(struct student),1,fp)!=1) printf(file write errorn);fclose(fp);break;p1=p1-next;while(p1!=NULL); fclose(fp);D 查找 void search ()程序清单:结束/void search1()int i;printf(please input your choice(0-2); printf(|n);printf(| in NO.|n);printf(| in name|n);printf(|n);printf(|n);d。

13、oprintf(input your choice); scanf(%d,&i);while(i!=1&i!=2&i!=0);switch(i)case1: searchnum(); break;case2: searchname(); break;default: exit(0);2、void searchname()struct student *p1,*p2,*head;char name16;head=recreat();printf(enter the students name:n);scanf(%d,name);for(p1=head;p1-next!=NULL;p1=p1-ne。

14、xt) if(strcmp(p1-name,name)=0)printf(,%dt%st%st%ct%dt%st%sn, p1-num,p1-name,p1-tel,p1-sex, p1-age,p1-bir,p1-add);void searchnum()struct student *p1,*p2,*head;int num;head=recreat();printf(enter the students NO.:n);scanf(%d,&num);for(p1=head;p1-next!=NULL;p1=p1-next)if(p1-num=num)printf(,%dt%st%st%ct%dt%st%sn, p1-num,p1-name,p1-tel,p1-sex, p1-age,p1-bir,p1-add。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值