住房管理系統(tǒng).doc_第1頁(yè)
住房管理系統(tǒng).doc_第2頁(yè)
住房管理系統(tǒng).doc_第3頁(yè)
住房管理系統(tǒng).doc_第4頁(yè)
住房管理系統(tǒng).doc_第5頁(yè)
已閱讀5頁(yè),還剩12頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

課程設(shè)計(jì)說(shuō)明書(shū)課程名稱: 數(shù)據(jù)結(jié)構(gòu)課程設(shè)計(jì) 專業(yè): 軟件工程 班級(jí): 103061 姓名: 蘇楠 學(xué)號(hào): 06 指導(dǎo)教師: 李瑩 成績(jī): 完成日期: 2012 年 1 月 13 日15 任 務(wù) 書(shū)題目:住房管理系統(tǒng)設(shè)計(jì)內(nèi)容及要求: 要求:(1)基本掌握面向過(guò)程程序設(shè)計(jì)的基本思路和方法; (2)達(dá)到熟練掌握數(shù)據(jù)結(jié)構(gòu)的基本知識(shí)和技能; (3)能夠利用所學(xué)的基本知識(shí)和技能,解決簡(jiǎn)單的程序設(shè)計(jì)問(wèn)題。 內(nèi)容:總體設(shè)計(jì)即概念模型設(shè)計(jì),使用數(shù)據(jù)流圖可以使我們的邏輯結(jié)構(gòu)一目了然,用圖形表示出來(lái),將更利于我們理解和設(shè)計(jì)。以下為住房管理系統(tǒng)的數(shù)據(jù)流圖: 性別,稱職門(mén)牌號(hào),姓名 年齡 入住時(shí)間 房基本信息 圖1:住房基本信息房子 姓名 住房號(hào) 圖2:房子實(shí)體圖錄入模塊 查找模塊年齡入住時(shí)間按住房號(hào)查詢按姓名查詢通過(guò)住房號(hào)性別稱職 刪除模塊通過(guò)姓名住房管理系統(tǒng)住房號(hào)姓名修改所有開(kāi)發(fā)環(huán)境:C+6.0 實(shí)現(xiàn)目標(biāo):1、可以按姓名查找住房的信息2、可以按住房號(hào)來(lái)查找住房的信息3、能對(duì)信息的修改,保存,顯示,刪除信息4、錄入和保存用戶信息5,、游覽,刪除,添加,修改,查詢用戶信息1系統(tǒng)實(shí)現(xiàn) 1.1錄入模塊實(shí)現(xiàn)功能:錄入基本信息界面:主要實(shí)現(xiàn)代碼:user *user:input(user *head)ifstream in;in.open(user.txt,ios:in|ios:nocreate); 1.2查找模塊實(shí)現(xiàn)功能:進(jìn)行對(duì)基本信息的查找界面: 主要實(shí)現(xiàn)代碼: void user:find(user *head) int cn; coutntt1.按姓名查找.n tt2.按住房號(hào)查找.n tt3.基本查找.n tt4.退出系統(tǒng).n; coutcn; 1.3 刪除模塊實(shí)現(xiàn)功能:進(jìn)行對(duì)基本信息的刪除界面:主要實(shí)現(xiàn)代碼:user *user:delete_user(user *head) char input30; int cn=0; coutntt1.通過(guò)姓名; coutntt2.通過(guò)住房號(hào); coutcn; 2代碼實(shí)現(xiàn)/-住房管理系統(tǒng)-#include#include#include#include#include/-數(shù)據(jù)結(jié)構(gòu)-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 *);/按住房號(hào)查找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;/-主函數(shù)-void main()user *head; head=new user;head-handle_menu(head);/-int user:menu_select()int cn; coutnn- 住房管理系統(tǒng) -endlendl;couttt1.錄入與保存用戶信息.n;couttt2.瀏覽用戶信息.n;couttt3.刪除用戶信息.n;couttt4.添加用戶信息.n;couttt5.修改用戶信息.n;couttt6.查詢用戶信息.n; couttt7.退出系統(tǒng).nn;coutcn;if(cn7)coutntt輸入錯(cuò)誤,重選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沒(méi)有記錄可存!endl;return;ofstream out;out.open(user.txt,ios:out);if(!out)coutntt不能打開(kāi)文件!endl;exit(1);coutntt存文件.endl;outcountn;user *p=head;while(p!=NULL)outnext;out.close();coutnnt count 條紀(jì)錄已經(jīng)存入文件,請(qǐng)繼續(xù)操作。endl;/-錄入函數(shù)-user *user:input(user *head)ifstream in;in.open(user.txt,ios:in|ios:nocreate);if(!in) coutntt還沒(méi)建立用戶,退出時(shí)請(qǐng)保存文件。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 的信息:(當(dāng)輸入 0 時(shí)結(jié)束。)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;/-查詢函數(shù)-void user:find(user *head)int cn; coutntt1.按姓名查找.ntt2.按住房號(hào)查找.ntt3.基本查找.ntt4.退出系統(tǒng).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沒(méi)有找到相應(yīng)的記錄!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現(xiàn)在沒(méi)有記錄!endl;return;user *p;p=head;coutnt現(xiàn)共有如下count條數(shù)據(jù):nn;coutt住房號(hào)t姓名t性別t職稱t年齡t入住時(shí)間nn;for(int i=0;icount;i+)tg.sextg.positiontg.agetg.datenext;coutendl;/-void user:show(user *p)coutt住房號(hào)t姓名t性別t職稱t年齡t入住時(shí)間n;tg.sextg.positiontg.agetg.datenext;/-添加-user *user:add(user *head)ifstream in;in.open(user.txt,ios:in|ios:nocreate);if(!in) coutt還沒(méi)建立用戶,退出時(shí)請(qǐng)保存文件。count=0)head=load(head);user *info,*star;star=new user;info=head;while(info-next!=NULL)info=info-next;coutntt請(qǐng)輸入要添加的用戶信息: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.通過(guò)姓名;coutntt2.通過(guò)住房號(hào);coutcn;while(1)switch(cn) case 1:coutntt請(qǐng)輸入姓名:;break; case 2:coutntt請(qǐng)輸入住房號(hào):;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您要?jiǎng)h除用戶的信息如下: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記錄已經(jīng)刪空。endl; return head; else if(c=2)return head;elsecoutc;elseold=p;p=p-next;coutntt沒(méi)有找到相應(yīng)的記錄。endl;return head;user *user:load(user *head)void search(user *head); return(head); 結(jié)論通過(guò)兩星期的數(shù)據(jù)結(jié)構(gòu)程序設(shè)計(jì)實(shí)習(xí),我們從中受益匪淺,并且對(duì)數(shù)據(jù)結(jié)構(gòu)程序設(shè)計(jì)這一門(mén)課程有了更深一步的認(rèn)識(shí)。在實(shí)習(xí)中,我們接觸到了一門(mén)新的語(yǔ)言delphi,它提供給我們一個(gè)可視化的操作界面,更能激發(fā)同學(xué)們的興趣愛(ài)好,所以我們學(xué)起來(lái)就有一股熱情。我們把這學(xué)期所學(xué)的理論知識(shí)和實(shí)踐聯(lián)系起來(lái),在所開(kāi)發(fā)的項(xiàng)目中漸漸成長(zhǎng)。雖然我們對(duì)這些新的知識(shí)運(yùn)用得還不是很熟練,但是相信我們也在滴水穿石地成長(zhǎng)起來(lái)。發(fā)現(xiàn)問(wèn)題,提出問(wèn)題,解決問(wèn)題,使

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論