住房管理系统.doc_第1页
住房管理系统.doc_第2页
住房管理系统.doc_第3页
住房管理系统.doc_第4页
住房管理系统.doc_第5页
已阅读5页,还剩12页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

课程设计说明书课程名称: 数据结构课程设计 专业: 软件工程 班级: 103061 姓名: 苏楠 学号: 06 指导教师: 李莹 成绩: 完成日期: 2012 年 1 月 13 日15 任 务 书题目:住房管理系统设计内容及要求: 要求:(1)基本掌握面向过程程序设计的基本思路和方法; (2)达到熟练掌握数据结构的基本知识和技能; (3)能够利用所学的基本知识和技能,解决简单的程序设计问题。 内容:总体设计即概念模型设计,使用数据流图可以使我们的逻辑结构一目了然,用图形表示出来,将更利于我们理解和设计。以下为住房管理系统的数据流图: 性别,称职门牌号,姓名 年龄 入住时间 房基本信息 图1:住房基本信息房子 姓名 住房号 图2:房子实体图录入模块 查找模块年龄入住时间按住房号查询按姓名查询通过住房号性别称职 删除模块通过姓名住房管理系统住房号姓名修改所有开发环境:C+6.0 实现目标:1、可以按姓名查找住房的信息2、可以按住房号来查找住房的信息3、能对信息的修改,保存,显示,删除信息4、录入和保存用户信息5,、游览,删除,添加,修改,查询用户信息1系统实现 1.1录入模块实现功能:录入基本信息界面:主要实现代码:user *user:input(user *head)ifstream in;in.open(user.txt,ios:in|ios:nocreate); 1.2查找模块实现功能:进行对基本信息的查找界面: 主要实现代码: void user:find(user *head) int cn; coutntt1.按姓名查找.n tt2.按住房号查找.n tt3.基本查找.n tt4.退出系统.n; coutcn; 1.3 删除模块实现功能:进行对基本信息的删除界面:主要实现代码:user *user:delete_user(user *head) char input30; int cn=0; coutntt1.通过姓名; coutntt2.通过住房号; coutcn; 2代码实现/-住房管理系统-#include#include#include#include#include/-数据结构-struct zfchar no10;char name16;char sex5; char position20;int age;char date30;/-用户类-class userprivate:zf g;user *next;public:int menu_select();static int count;user();user();void handle_menu(user *);user *input(user *);user *load(user *);void find(user *);/查找 void find_na(user *);/按姓名查找void find_no(user *);/按住房号查找user *add(user *);/添加信息 / user *edit(user *);/修改void save(user *);/保存信息void display(user *);/显示信息void show(user *); user *delete_user(user *);/删除friend ostream &operator(istream &is,user &ob);int user:count=0;user:user()/初始化next=NULL;g.no0= ;0=0;g.sex0= ;g.position0= ;g.age=0;g.date0= ;user:user()if(next!=NULL)delete next;/-主函数-void main()user *head; head=new user;head-handle_menu(head);/-int user:menu_select()int cn; coutnn- 住房管理系统 -endlendl;couttt1.录入与保存用户信息.n;couttt2.浏览用户信息.n;couttt3.删除用户信息.n;couttt4.添加用户信息.n;couttt5.修改用户信息.n;couttt6.查询用户信息.n; couttt7.退出系统.nn;coutcn;if(cn7)coutntt输入错误,重选1-7:;elsebreak;return cn;/-菜单处理-void user:handle_menu(user *head)for(;)switch(menu_select()case 1:head=input(head);couts;for(;)if(s=1)save(head);break;if(s=2)break;elsecouts;break;case 2:display(head);break;case 3:head=delete_user(head);break;case 4:add(head);break;case 5:/head=edit(head);break;case 6:find(head);break;case 7:0=0)coutntt没有记录可存!endl;return;ofstream out;out.open(user.txt,ios:out);if(!out)coutntt不能打开文件!endl;exit(1);coutntt存文件.endl;outcountn;user *p=head;while(p!=NULL)outnext;out.close();coutnnt count 条纪录已经存入文件,请继续操作。endl;/-录入函数-user *user:input(user *head)ifstream in;in.open(user.txt,ios:in|ios:nocreate);if(!in) coutntt还没建立用户,退出时请保存文件。count=0)head=load(head);user *info,*star;star=new user;info=head;while(info-next!=NULL)info=info-next;-head-count;/int j=0;do/j+;+head-count;coutntt输入用户 count+1 的信息:(当输入 0 时结束。)n;coutstar-g.no;if(strcmp(star-g.no,0)=0) break;;coutstar-g.sex; coutstar-g.position;coutstar-g.age; coutstar-g.date;if(head-count=0)head=star;info-next=star;info=star;star=new user;while(1);info-next=NULL;return(head);/-istream &operator(istream &is,user &ob)is.getline(ob.g.no,10,n);is.getline(,16,n);isob.g.no;;isob.g.sex;isob.g.position;isob.g.age;isob.g.date;return is;ostream &operator(ostream &os,user &ob)osob.g.non;n;osob.g.sexn;osob.g.positionn;osob.g.agen;osob.g.daten;return os;/-查询函数-void user:find(user *head)int cn; coutntt1.按姓名查找.ntt2.按住房号查找.ntt3.基本查找.ntt4.退出系统.n;coutcn;doswitch(cn)case 1:find_na(head);break;case 2:find_no(head);break;case 3:display(head);break; case 4:exit(0);while(cn4);/-void user:find_na(user *head)char input16;user *p;coutinput;p=head;while(p!=NULL)if(strcmp(input,)=0) coutn您要查找的信息如下:nnext; if(p=NULL)coutntt没有找到相应的记录!nendl; return;/-void user:find_no(user *head)char input16;int sum=0;int number=0;user *p;coutinput;p=head;while(p!=NULL)if(strcmp(input,p-g.no)=0)coutntt您要查找的信息如下:nnext;if(p=NULL) printf(ttnot find!n);return;/-浏览-void user:display(user *head)if(head-count=0)coutntt现在没有记录!endl;return;user *p;p=head;coutnt现共有如下count条数据:nn;coutt住房号t姓名t性别t职称t年龄t入住时间nn;for(int i=0;icount;i+)tg.sextg.positiontg.agetg.datenext;coutendl;/-void user:show(user *p)coutt住房号t姓名t性别t职称t年龄t入住时间n;tg.sextg.positiontg.agetg.datenext;/-添加-user *user:add(user *head)ifstream in;in.open(user.txt,ios:in|ios:nocreate);if(!in) coutt还没建立用户,退出时请保存文件。count=0)head=load(head);user *info,*star;star=new user;info=head;while(info-next!=NULL)info=info-next;coutntt请输入要添加的用户信息:n; coutstar-g.no;;coutstar-g.sex; coutstar-g.position;coutstar-g.age; coutstar-g.date;couts; for(;) if(s=1)head-count+;save(head);break;if(s=2)break;elsecoutcount=0)head=star;info-next=star;info=star;star=new user;info-next=NULL;return(head);/-删除-user *user:delete_user(user *head)char input30;int cn=0;coutntt1.通过姓名;coutntt2.通过住房号;coutcn;while(1)switch(cn) case 1:coutntt请输入姓名:;break; case 2:coutntt请输入住房号:;if(cn!=1&cn!=2)coutcn;else break;cininput;user *old,*p;p=head;old=head;while(p!=NULL)if(cn=1&strcmp(input,)=0)|(cn=2&strcmp(input,p-g.no)=0)coutntt您要删除用户的信息如下:nn;show(p);coutc;for(;)if(c=1)if(p=head) head=p-next; else old-next=p-next; -count; coutntt记录已清空!n; return head; if(count=0) head=new user; coutntt记录已经删空。endl; return head; else if(c=2)return head;elsecoutc;elseold=p;p=p-next;coutntt没有找到相应的记录。endl;return head;user *user:load(user *head)void search(user *head); return(head); 结论通过两星期的数据结构程序设计实习,我们从中受益匪浅,并且对数据结构程序设计这一门课程有了更深一步的认识。在实习中,我们接触到了一门新的语言delphi,它提供给我们一个可视化的操作界面,更能激发同学们的兴趣爱好,所以我们学起来就有一股热情。我们把这学期所学的理论知识和实践联系起来,在所开发的项目中渐渐成长。虽然我们对这些新的知识运用得还不是很熟练,但是相信我们也在滴水穿石地成长起来。发现问题,提出问题,解决问题,使

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论