




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、* 学 院课程设计说明书班级: 计算机z091 姓名: 设计题目: 通讯录管理系统 设计时间: 2011.02.28 至 2011.03.11 指导教师: 评 语:_评阅成绩: 评阅教师: 一设计题目与要求1.通讯录的制作设计目的:用数据结构中的单链表作数据结构,结合c语言基本知识。编写一个通讯录管理系统。以把所学数据结构知识应用到实际软件开发中去。设计内容:本系统应完成以下几方面的功能:1)输入信息enter();2)显示信息display( );3)查找以姓名或id号码作为关键字 search( );4)删除信息delete( );5)设置字体颜色color();6)存盘save ( );
2、7)退出exit( ) ;设计要求:1)每条信息至少包含 :姓名,id号码,电话号码,工资,工龄几项2)作为一个完整的系统,应具有友好的界面和较强的容错能力3)上机能正常运行二概要设计系统结构图主菜单添加通讯录信息显示所有记录删除所需删除的记录查询记录设置字体颜色按姓名查询按id号查询保存记录到文件退出(不保存)三详细设计1.单链表的编写开发项目时,以单链表的形式来组织、封装一些常用的方法,以提高代码的重用率,大大方便了代码的管理。本系统创建了一个单链表。主要用来定义员工基本信息。2.基本操作函数的定义void searchname(struct worker *head) void sear
3、chid(struct worker *head) void save(struct worker *head)void display(struct worker *head) struct worker *enter(struct worker *head)struct worker *del(struct worker *head)3.主要函数流程图display(struct worker *head) *del(struct worker *head)searchid(struct worker *head) *enter(struct worker *head)开始输入要删除的id
4、号p1=headhead=nullstrcmp(p1-num,num)=0p2=p1 p1=p1-next删除此联系 人yesnoonoyes返回主菜单开始p=headp!=null输出员工各信息p=pnextp!=null返回主菜单yesno 开始p1=headp1!=nullstrcmp(p1-num,num)=0p1=p1-next输出信息noyes返回主菜单yesno开始p0申请空间gjian输入联系人信息对插入节点按姓名拼音排序返回主菜单四、运行结果和调试分析1.增加学生信息运行结果如图:实现思想:录入完一条信息后,会提示“恭喜您成功添加了联系人信息”,双击enter即可回到主菜单。
5、2.显示通讯里所有记录实现思想:在查看学生数据时,需要先判断有无记录,若无记录则提示系统中无员工信息,请先输入。否则按姓名拼音排序方式将系统中的全部信息输出。3.删除员工信息运行结果如图所示:实现思想:删除数据时,需要先判断有无记录,若无记录提示无信息,双击enter返回主菜单。否则提示输入要删除的学生的学号,在输入学号后,先判断系统中有无此学号,若无则提示系统中无此记录。否则将删除该学号的学生信息。4. 查询员工信息查询员工信息运行结果如图所示: 选择0,退出查询返回主菜单;选择1,按id号查询;选择2,按姓名查询。选择1(id查询):选择2(姓名查询):5.设置字体颜色:通过“system
6、(color 0*);(其中*为十六进制数)”来设置字体颜色。选择相应选项后,自动返回主菜单,主菜单字体颜色依您的选择而改变。6.保存通讯录所有记录到文件中:文件保存后,按任意键退出。此即为保存的record.txt文件。 7.如果不想保存文件就退出,选择七号功能。 五、总结体会 两个星期的数据结构课程设计,从头到尾的实践和体验,对于我们来说学到的不仅是那些知识,更多的是团队和合作。写到最后的收获及体会时感触颇深,也许学校安排的课程设计有着更深层的意义。它不仅让我们综合那些理论知识来运用到设计和创新,还让我们知道了一个团队凝聚在一起所能发挥出的巨大潜能!通过这次课程设计,使我们学到了一些以前没
7、有学过的知识,使我们对数据结构程序设计有了更深层次的认识和理解,懂得了灵活运用。在计算机飞速发展的今天,懂得一门计算机语言技术是非常必要的。同时,我们也清醒的认识到,只要自己肯努力,愿意去付出劳动,就能够得到属于我们自己所期望的东西。这次课程设计遇到的问题远比我们想象的多,没想到这项看起来很简单的课题却是需要非常多的耐心和精力,在做本次课程设计的过程中,我感触最深的当属查阅大量的设计资料了。为了让自己的设计更加完善,查阅这方面的资料是非常必要的,同时也是必不可少的。在这次课程设计中我们运用到了以前所学的专业课知识,如c+、数据结构等。在设计的同时,我们还发现了自己的不足之处,对以前所学的知识理
8、解的不够深刻、掌握的不够牢固。而且即使感觉自己的理论上已经掌握,但运用到实践过程中仍有意想不到的困难,比如删除那一块的程序,经过一番努力才得以解决。这也激发了我们今后努力学习的兴趣。最后,在此由衷的向我们的指导老师表示感谢,是他的悉心指导和严格要求,才使我们的课程设计有了较为完善的一面,才有了我们能力的提高,并在老师的帮助下得到了充分的锻炼。六.源程序附录:#include #include #include #include /包含system函数头文件#define len sizeof(struct worker)struct worker char num20;/员工id号码 char
9、 name100;/员工姓名 char earnings20;/每月工资 char phone100;/联系方式 char workingage20;/员工工龄 struct worker *next; ;void face(void)/功能选择面板 printf(tt,.,.,. n); printf(tto,.,. n ); printf(tt田田田 ,.,. n); printf(ttn); printf(nttt欢迎使用利您通讯录); printf(nnt选择你需要操作的功能:(初次使用,建议先添加记录)n); printf(n); printf(ttt1.【增加通讯录信息n); pr
10、intf(ttt2.显示通讯录中所有记录】n); printf(ttt3.【删除需要删除的信息n); printf(ttt4.以名字或id号码查询所需的信息】n); printf(ttt5.【设置字体颜色n); printf(ttt6.保存通讯录中的所有记录到指定文件中】n); printf(ttt7.【退出不保存!n); printf(n); printf(tn); void colour() /设置字体颜色 int color;system(cls);printf( -n);printf(), ) 勤奋- n);printf(,),) ,), , , . -努力-n);printf( ,
11、- -每一n);printf(田田田田 , 天 -n);printf( - -nnn); printf( 1:蓝色 2:绿色 3:湖蓝 n 4:红色 5:紫色 6:黄色 n 7:白色 8:灰色 9:淡蓝 n 0:默认颜色 n 10-15更多好看颜色); printf(请选择喜欢的颜色:); scanf(%d,&color); if(color=0) system(color 2a); else if(color=1) system(color 01); else if(color=2)system(color 02); else if(color=3)system(color 03); els
12、e if(color=4)system(color 04); else if(color=5)system(color 05); else if(color=6)system(color 06); else if(color=7)system(color 07); else if(color=8)system(color 08); else if(color=9)system(color 09); else if(color=10)system(color 0a); else if(color=11)system(color 0b); else if(color=12)system(color
13、 0c); else if(color=13)system(color 0d); else if(color=14)system(color 0e); else if(color=15)system(color 0f);system(cls);struct worker *enter(struct worker *head) /增添电子通讯录中的内容,即创建链表过程 char i; struct worker *p0=null,*p1,*p2;/p0为要插入的新节点 p1=head; p2=head; system(cls); printf(nn n); printf(ttt你能在此目录下创建
14、并添加联系人信息); printf(nt n); p0=(struct worker *)malloc(len); printf(请输入联系人id号码:); gets(p0-num); printf(请输入联系人姓名:); gets(p0-name); printf(请输入联系人工资:); gets(p0-earnings); printf(请输入联系人电话:); gets(p0-phone); printf(请输入联系人工龄:); gets(p0-workingage);printf(nn恭喜您!成功添加了联系人信息!nn双击enter返回主菜单nn);scanf(%c,&i); if(he
15、ad=null)/对插入的节点排序,按姓名的拼音顺序 head=p0;p0-next=null;/之前无结点 else while(strcmp(p0-name,p1-name)0)&(p1-next!=null) p2=p1;p1=p1-next; if(strcmp(p0-name,p1-name)next=p0; p0-next=p1;/插入到中间位置 else p1-next=p0;p0-next=null;/插入到最后位system(cls); return(head);void display(struct worker *head) char i; struct worker *
16、p; p=head; system(cls);/调用dos命令cls能够清屏 printf( 用户信息记录表nn); printf(ttnn); if(head!=null) do printf(ttt联系人id号码:%sn,p-num); printf(ttt联系人姓名:%sn,p-name); printf(ttt联系人工资:%sn,p- earnings); printf(ttt联系人电话号码:%sn,p-phone); printf(ttt联系人工龄:%sn,p-workingage); printf(nttnn); p=p-next; while(p!=null); else pri
17、ntf(对不起!没有任何联系人记录!nn); printf(nn双击enter返回主菜单nn);scanf(%c,&i);system(cls);struct worker *del(struct worker *head) /电子通讯录的维护(删除) char i; struct worker *p1,*p2; char num20; system(cls); printf(nn n); printf( 卐卐卐卐卐卐卐卐 用户信息记录删除功能 卐卐卐卐卐卐卐卐n); printf( n); printf(输入要删除的联系人id号码:); gets(num); p1=head; if (hea
18、d=null) printf(很抱歉!没有任何联系人纪录!n); printf(n*n); printf(nn双击enter返回主菜单nn); scanf(%c,&i);system(cls); return(head); while(p1!=null) if(strcmp(p1-num,num)=0) if(p1=head) head=p1-next; else p2-next=p1-next; free(p1); printf(删除记录成功!n); printf(nn双击enter返回主菜单nn); scanf(%c,&i); system(cls); return(head); p2=p
19、1; p1=p1-next; printf(对不起!没有要删除的联系人纪录!n); printf(nn双击enter返回主菜单nn);scanf(%c,&i);system(cls); return(head);void searchname(struct worker *head) /电子通讯录的查找,关键字为用户姓名; char i,c; struct worker *p1; char name20; p1=head; system(cls); printf( 用户信息记录查询功能-按姓名查询 n); printf(n); printf(输入要查找联系人的姓名:); scanf(%s,na
20、me); while(p1!=null) if(strcmp(p1-name,name)=0) printf(联系人id号码:); puts(p1-num); printf(联系人姓名:); puts(p1-name); printf(联系人月工资:); puts(p1-earnings); printf(联系人电话号码:); puts(p1-phone); printf(联系人工龄:); puts(p1-workingage); break; p1=p1-next; if(p1=null) printf(对不起!没有该联系人的纪录!n); printf(nn双击enter返回主菜单nn);
21、scanf(%c,&i); scanf(%c,&c); system(cls); void searchid(struct worker *head) /电子通讯录的查找,关键字为用户id号码 char i,c; struct worker *p1; char num20; p1=head; system(cls); printf( 用户信息记录查询功能-按id号查询 n); printf(n); printf(输入要查找联系人的id:);scanf(%s,num); while(p1!=null) if(strcmp(p1-num,num)=0) printf(联系人id号码:); puts
22、(p1-num); printf(联系人姓名:); puts(p1-name); printf(联系人月工资:); puts(p1-earnings); printf(联系人电话号码:); puts(p1-phone); printf(联系人工龄:); puts(p1-workingage); break; p1=p1-next; if(p1=null) printf(对不起!没有该联系人的纪录!n); printf(nn双击enter返回主菜单nn); scanf(%c,&i); scanf(%c,&c); system(cls); void search(struct worker *he
23、ad) int option; system(cls); printf(n n); printf(n* 0. 退出 1.按id号 2.按姓名 *n); printf(nn); printf(请选择: ); scanf(%d,&option); switch(option) case 0: system(cls); break; case 1: searchid(head);break; case 2: searchname(head);break; default: printf(选项无效! n);break; void save(struct worker *head) /电子通讯录的记录存盘操作,使用文件指针; file *fp1; struct worker *p; p=head; fp1=fopen(record.txt,w); fprintf(fp1, 用户信息记录表 n); while(p!=
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 教师如何处理课堂冲突面试题目及答案
- 计算机账户管理考试题及答案
- Excel函数(AVERAGE)运用考试题及答案
- 丁腈橡胶装置操作工新员工考核试卷及答案
- 插花花艺师职业技能考核试卷及答案
- 白蚁防治工理念考核试卷及答案
- 纬编工理念考核试卷及答案
- 浓硝酸工特殊工艺考核试卷及答案
- 蚕饲养员设备调试考核试卷及答案
- 废片白银回收工效率提升考核试卷及答案
- 光伏电站入股分红协议书
- 【行星齿轮的强度校核计算过程案例】1800字
- 轻度认知障碍 - 教学课件
- 十大国企面试题目及答案
- 《智慧供应链管理》课件
- 2025-2030吉林省生活垃圾清运和处理行业市场发展分析及发展前景与投资研究报告
- 山香教育协议班合同
- 部编版语文四年级上册第一单元大单元教学设计
- 老年慢性病的中药调理方法
- 典当黄金合同标准文本
- 旧厂房改造施工安全措施
评论
0/150
提交评论