




已閱讀5頁,還剩12頁未讀, 繼續(xù)免費閱讀
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
課程設(shè)計說明書課程名稱: 數(shù)據(jù)結(jié)構(gòu)課程設(shè)計 專業(yè): 軟件工程 班級: 103061 姓名: 蘇楠 學(xué)號: 06 指導(dǎo)教師: 李瑩 成績: 完成日期: 2012 年 1 月 13 日15 任 務(wù) 書題目:住房管理系統(tǒng)設(shè)計內(nèi)容及要求: 要求:(1)基本掌握面向過程程序設(shè)計的基本思路和方法; (2)達(dá)到熟練掌握數(shù)據(jù)結(jié)構(gòu)的基本知識和技能; (3)能夠利用所學(xué)的基本知識和技能,解決簡單的程序設(shè)計問題。 內(nèi)容:總體設(shè)計即概念模型設(shè)計,使用數(shù)據(jù)流圖可以使我們的邏輯結(jié)構(gòu)一目了然,用圖形表示出來,將更利于我們理解和設(shè)計。以下為住房管理系統(tǒng)的數(shù)據(jù)流圖: 性別,稱職門牌號,姓名 年齡 入住時間 房基本信息 圖1:住房基本信息房子 姓名 住房號 圖2:房子實體圖錄入模塊 查找模塊年齡入住時間按住房號查詢按姓名查詢通過住房號性別稱職 刪除模塊通過姓名住房管理系統(tǒng)住房號姓名修改所有開發(fā)環(huán)境:C+6.0 實現(xiàn)目標(biāo):1、可以按姓名查找住房的信息2、可以按住房號來查找住房的信息3、能對信息的修改,保存,顯示,刪除信息4、錄入和保存用戶信息5,、游覽,刪除,添加,修改,查詢用戶信息1系統(tǒng)實現(xiàn) 1.1錄入模塊實現(xiàn)功能:錄入基本信息界面:主要實現(xiàn)代碼:user *user:input(user *head)ifstream in;in.open(user.txt,ios:in|ios:nocreate); 1.2查找模塊實現(xiàn)功能:進行對基本信息的查找界面: 主要實現(xiàn)代碼: void user:find(user *head) int cn; coutntt1.按姓名查找.n tt2.按住房號查找.n tt3.基本查找.n tt4.退出系統(tǒng).n; coutcn; 1.3 刪除模塊實現(xiàn)功能:進行對基本信息的刪除界面:主要實現(xiàn)代碼:user *user:delete_user(user *head) char input30; int cn=0; coutntt1.通過姓名; coutntt2.通過住房號; coutcn; 2代碼實現(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 *);/按住房號查找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輸入錯誤,重選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 條紀(jì)錄已經(jīng)存入文件,請繼續(xù)操作。endl;/-錄入函數(shù)-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 的信息:(當(dāng)輸入 0 時結(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.按住房號查找.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沒有找到相應(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)在沒有記錄!endl;return;user *p;p=head;coutnt現(xiàn)共有如下count條數(shù)據(jù):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記錄已經(jīng)刪空。endl; return head; else if(c=2)return head;elsecoutc;elseold=p;p=p-next;coutntt沒有找到相應(yīng)的記錄。endl;return head;user *user:load(user *head)void search(user *head); return(head); 結(jié)論通過兩星期的數(shù)據(jù)結(jié)構(gòu)程序設(shè)計實習(xí),我們從中受益匪淺,并且對數(shù)據(jù)結(jié)構(gòu)程序設(shè)計這一門課程有了更深一步的認(rèn)識。在實習(xí)中,我們接觸到了一門新的語言delphi,它提供給我們一個可視化的操作界面,更能激發(fā)同學(xué)們的興趣愛好,所以我們學(xué)起來就有一股熱情。我們把這學(xué)期所學(xué)的理論知識和實踐聯(lián)系起來,在所開發(fā)的項目中漸漸成長。雖然我們對這些新的知識運用得還不是很熟練,但是相信我們也在滴水穿石地成長起來。發(fā)現(xiàn)問題,提出問題,解決問題,使
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025至2030中國電傳動系統(tǒng)行業(yè)供需風(fēng)險與企業(yè)營銷模式建議報告
- 2025至2030中國甘氨酸鈣行業(yè)發(fā)展趨勢分析與未來投資戰(zhàn)略咨詢研究報告
- 2025至2030中國珍珠養(yǎng)殖市場需求規(guī)模與競爭策略分析報告
- 智能機器人導(dǎo)購服務(wù)協(xié)議
- 小學(xué)四年級數(shù)學(xué)三位數(shù)除以兩位數(shù)能力考核題帶答案
- 小學(xué)三年級數(shù)學(xué)兩位數(shù)乘兩位數(shù)筆算競賽練習(xí)練習(xí)題
- 三位數(shù)乘兩位數(shù)綜合作業(yè)模擬題
- 汽車配件銷售及維修協(xié)議
- 綜合型農(nóng)業(yè)科技服務(wù)協(xié)作書或協(xié)議
- 農(nóng)產(chǎn)品采購供應(yīng)長期合作合同
- 第19章一次函數(shù)-一次函數(shù)專題數(shù)形結(jié)合一一次函數(shù)與45°角模型講義人教版數(shù)學(xué)八年級下冊
- 2023年四川省宜賓市敘州區(qū)數(shù)學(xué)六年級第二學(xué)期期末考試模擬試題含解析
- 幼兒園警察職業(yè)介紹課件
- 棉印染清潔生產(chǎn)審核報告
- 滅火器維修與報廢規(guī)程
- 皮膚病的臨床取材及送檢指南-修訂版
- 機型理論-4c172實用類重量平衡
- 校企合作項目立項申請表(模板)
- 管道工廠化預(yù)制推廣應(yīng)用課件
- 海水的淡化精品課件
- 項目工程移交生產(chǎn)驗收報告
評論
0/150
提交評論