《C语言课程设计宾馆住宿系统ogb.docx》由会员分享,可在线阅读,更多相关《C语言课程设计宾馆住宿系统ogb.docx(67页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、华中科技技大学计计算机科科学与技技术学院院C语言言程序设设计课课程设计计实验报告告题目:宾宾馆住宿宿信息管管理系统统 专业业: 班级级:学号: 姓名名: 成绩绩:指导教师师:完成日期期: 20年 100 月 1 日日宾馆管理理住宿系系统一实验目目的:1、进一一步掌握握和利用用C语言言进行程程设计的的能力; 2、 进一步步理解和和运用结结构化程程设计的的思想和和方法; 3、 初步掌掌握开发发一个小小型实用用系统的的基本方方法; 4、 学会调调试一个个较长程程序的基基本方法法; 55、 学学会利用用流程图图或N-S图表表示算法法; 66、 掌掌握书写写程设计计开发文文档的能能力(书书写课程程设计报
2、报告);二实验要要求:1、只能能使用CC语言,源源程序要要有适当当的注释释,使程程序容易易阅读。2、要有有用户界界面。要要求至少少采用简简易菜单单;鼓励励采用文文本菜单单界面甚甚至采用用图形菜菜单界面面。3、必须须使用结结构和十十字交叉叉链表等等数据结结构。4、使用用文件保保存数据据。5、至少少输出一一份报表表(屏幕幕输出即即可),鼓鼓励自行行增加新新功能。功能要求求(宾馆住住宿信息息管理系系统): 对宾馆所所有客房房的住宿宿信息进进行管理理,主要要包括客客房基本本信息、客客户住宿宿信息。包含功能能:客房房基本信信息录入入。允许对对已经录录入的数数据重新新进行编编辑、修修改,各种基基本数据据的
3、插入入、删除,基于各各种数据据的查询询、统计计计算。宾馆住宿宿信息其其它方面面的统计计(自行行确定)。三实验内内容:程序概况况本程序采采用文本本菜单界界面,程程序数据据结构采采用三个个方向的的十字链链表来处处理的。具具有对客客房基本本信息,客客户信息息的新建建、修改改、插入入、删除除、查找找、查看看、统计计、保存存、载入入等功能能。程序序虽简单单,但具具有完整整的功能能。程序模块块示意图图1) 主程序流流程图开始功能选择菜单判断选择保存数据结束新建插入 修改删除保存统计查找浏览载入获取按键2)主要要数据结结构图程序数据据结构采采用三个个方向的的十字链链表来处处理的。程序详细细介绍主要数据据结构
4、:typeedeff sttrucct kkehuuxinnxi chhar namme220;/*客客户姓名名*/ chhar id20;/*客户IID*/ chhar sexx;/*性性别*/ chhar tellephhonee200;/*电话话*/chhar rooom110;/*房房间号*/chhar timme112;/*入入住时间间*/flloatt yiingsshouu;/*应付费费用*/flloatt shhishhou;/*实实际费用用*/chhar shoouyiinyuuan20;/*收银员员*/sttrucct kkehuuxinnxi * nnextt; kkeh
5、uu,* Pkeehu;客户信息息包含客客户姓名名,IDD,性别别,房间间号,入入住时间间,应付付费用,实实际费用用,收银银员的资资料。typeedeff sttrucct kkefaangxxinxxi chhar numm100;/*房间间号*/ chhar zhoongllei;/*类类别*/ innt timmes;/*入入住次数数*/ flloatt jiiagee;/*价格*/ sttrucct kkefaangxxinxxi * neext; Pkkehuu RRecoord; ffanggjiaan,* Pffanggjiaan;客房信息息里包含含房间号号,房间间类别,入入住次
6、数数,房间间价格资资料。typeedeff sttrucct kkefaangzzhonngleei chhar zhoongllei;/*类类别*/ innt shuuliaang;/*房房间数*/ Pffanggjiaan ffirsst; sttrucct kkefaangzzhonngleei * neext; ffanggjiaanzhhonggleii ,* Pffanggjiaanzhhonggleii;房间种类类包含房房间类别别和房间间数目资资料。各函数功功能介绍绍(为方方便阅读读理解程程序,函函数名用用汉语拼拼音代替替)int xiaangddaohhejiiemiian(i
7、ntt fuuncttionn,Pffanggjiaanzhhonggleii * pRSST);绘制功能能选择界界面int Colllecct(iint (* Commp)(voiid *,vooid *),intt nuum);按照Coomp规规则收集集前nuum个信信息int jiyyushhijiian(voiid *,vooid *);按照次数数规则int jiyyujiiagee(vooid *,vvoidd *);按照价格格规则int huoodeccaiddan(chaar * * szTTitlles,intt nuum);获取菜单单int huoodekkefaangzzh
8、onngleei(FFILEE * pf,Pfaangjjiannzhoongllei subb_trree);获取一整整个类型型,客房房种类int huoodekkefaang(FILLE * pff,Pffanggjiaan rroomm);获取一个个房间信信息int huoodekkehuu(FIILE * ppf,PPkehhu ccusttom);获取一个个客户信信息int xieerukkefaangxxinxxi(FFILEE * pf,Pfaangjjiann rooom);写入客房房信息int xieerukkehuuxinnxi(FILLE * pff,Pkkehuu cu
9、ustoom);写入客户户信息int huoodennkeffangg(Pffanggjiaanzhhonggleii suub_ttreee,innt nnum_rooom);获取nuum_rroomm个房间间intxiuugaiikehhuxiinxii(Pkkehuu pCCu);修改客户户信息int xiuugaiikeffanggxinnxi(Pfaangjjiann pRRF);修改房间间信息int Colllecct(iint (* Commp)(voiid *,vooid *),intt nuum);按照Coomp规规则收集集前nuum个信信息int jiyyushhijiia
10、n(voiid *,vooid *);按照次数数规则int jiyyujiiagee(vooid *,vvoidd *);按照价格格规则int Dissplaay(vvoidd);int Gett_Innfo(chaar * * szTTitlles,chaar * * buffferr,innt nnum);int zhaanxiiankkehuu(Pkkehuu pCCu);int zhaanxiiankkefaang(Pfaangjjiann pRRF);显示客房房客户信信息int huoodekkehuuxinnxi(Pkeehu pCuu);获取客户户信息int souusuooke
11、ffanggzhoongllei(Pfaangjjiannzhoongllei pRSST);搜索一个个类型客客房种类类int souusuookeffanggxinnxi(Pfaangjjiannzhoongllei pRSST);搜索一个个客房int souusuookehhu(PPfanngjiianzzhonngleei ppRSTT);搜索一个个客户int tiaanjiiazhhonggleii(Pffanggjiaanzhhonggleii pRRST);插入客房房种类int tiaanjiiakeefanng(PPfanngjiianzzhonngleei ppRSTT);插入
12、一个个客房int tiaanjiiakeehu(Pfaangjjiannzhoongllei pRSST);插入一个个客户int shaanchhuzhhonggleii(Pffanggjiaanzhhonggleii * pRSST);删除客房房种类int shaanchhukeefanng(PPfanngjiianzzhonngleei * pRRST);删除客房房信息int shaanchhukeehu(Pfaangjjiannzhoongllei * ppRSTT);删除客户户信息int xiuugaiikeffanggzhoongllei(Pfaangjjiannzhoongllei
13、 pRSST);/修改客房房种类int xiuugaiikehhu(PPfanngjiianzzhonngleei ppRSTT);修改客户户信息int huoodekkefaangxxinxxi(PPfanngjiian pRFF);获得客房房信息/*Qssortt*/voidd Qssortt(vooid * * arrrayy,innt llow,intt hiigh,intt (*Commp)(voiid * ,vvoidd * );快速排序序法排序序四运行结结果1开始功功能选择择菜单2新建功功能界面面3插入功功能界面面4修改功功能界面面5删除功功能界面面6查找功功能界面面7查看功功能
14、界面面详细设计计:(源源程序清清单见附附录):五心得体体会 通过这次次实训,增增加了我我学习软软件技术术的兴趣趣,虽然然在编写写修改代代码的工工程中花花费了不不少时间间甚至有有放弃的的想法,但但最终看看到程序序运行,那那种喜悦悦兴奋之之情无法法用文字字描述。1. 编写课程程设计是是理论结结合实际际的一次次很好结结合,虽虽然写得得作业仅仅仅只能能当做一一项作业业没有实实际使用用的价值值,但还还是从中中学到了了不少,真真正地体体会到完完成一项项任务的的艰辛和和付出之之后收获获的快乐乐。2. 编写程序序时应该该使程序序易于理理解尽量量使用通通用的变变量名和和通俗的的注释。3. 虽然很多多东西刚刚开始
15、时时都不懂懂,但只只要坚持持下去学学,慢慢慢地就会会熟悉。4. 程序应该该分几个个文件装装,要有有条理性性。5. 写程序运运行时会会出现很很多buug,要要耐心调调试,编编程需要要耐心和和细心。把把程序完完整地调调试好后后,对自自己性格格的培养养也是一一种提高高。6. 当自己解解决不了了时要向向他人请请教,虚虚心学习习他人的的方法。这次完成作业向同学们请教了很多问题,得到了同学的帮助,在此真心地表示感谢。参考文献献Turrbo C 使使用大全全第一一册、第第二册 徐金梧梧等编译译 北京京科海培培训中心心C语言言课程设设计 曹计计昌 卢卢萍 李李开 编编著C程序序设计谭谭浩强 著附录源程序清清单
16、#ifnndeff DEEF#deffinee DEEF#deffinee BUUFSIIZE 20#deffinee MAAX_RROOMM 1000#deffinee TEEXT_CY 20#inccludde#inccludde#inccludde#inccludde#inccludde#inccludde#inccludde#deffinee TRRUE 1#deffinee FAALSEE 0#deffinee NAAME 20#deffinee MAAX_IID 220#deffinee NUUM 110#deffinee TEELE 20#deffinee TIIME 12typ
17、eedeff sttrucct kkehuuxinnxi chhar namme220;/*客客户姓名名*/ chhar id20;/*客户IID*/ chhar sexx;/*性性别*/ chhar tellephhonee200;/*电话话*/chhar rooom110;/*房房间号*/chhar timme112;/*入入住时间间*/flloatt yiingsshouu;/*应付费费用*/flloatt shhishhou;/*实实际费用用*/chhar shoouyiinyuuan20;/*收银员员*/sttrucct kkehuuxinnxi * nnextt; kkehuu,*
18、 Pkeehu;typeedeff sttrucct kkefaangxxinxxi chhar numm100;/*房间间号*/ chhar zhoongllei;/*类类别*/ innt timmes;/*入入住次数数*/ flloatt jiiagee;/*价格*/ sttrucct kkefaangxxinxxi * neext; Pkkehuu RRecoord; ffanggjiaan,* Pffanggjiaan;typeedeff sttrucct kkefaangzzhonngleei chhar zhoongllei;/*类类别*/ innt shuuliaang;/*房房
19、间数*/ Pffanggjiaan ffirsst; sttrucct kkefaangzzhonngleei * neext; ffanggjiaanzhhonggleii ,* Pffanggjiaanzhhonggleii;typeedeff sttrucctfaangjjiann * Buuffeer;innt BBufssizee;/*缓冲区区大小*/BBuf;typeedeff sttrucctinnt lleftt;innt ttop;innt rrighht;innt bbotttom;RRectt;/*矩形区区域,一一个好东东西*/*Guuidee*/int xiaangdd
20、aohhejiiemiian(intt fuuncttionn,Pffanggjiaanzhhonggleii * pRSST);/*tooolss*/int Colllecct(iint (* Commp)(voiid *,vooid *),intt nuum);/*按按照Coomp规规则收集集前nuum个信信息*/int jiyyushhijiian(voiid *,vooid *);/*按按照次数数规则*/int jiyyujiiagee(vooid *,vvoidd *);/*按照价价格规则则*/int huoodeccaiddan(chaar * * szTTitlles,intt
21、nuum);/*fuun_ffun*/int huoodekkefaangzzhonngleei(FFILEE * pf,Pfaangjjiannzhoongllei subb_trree);/*获取一一整个类类型*/int huoodekkefaang(FILLE * pff,Pffanggjiaan rroomm);/*获取取一个房房间*/int huoodekkehuu(FIILE * ppf,PPkehhu ccusttom);/*获取一一个客户户*/int xieerukkefaang(FILLE * pff,Pffanggjiaanzhhonggleii suub_ttreee);
22、int xieerukkefaangxxinxxi(FFILEE * pf,Pfaangjjiann rooom);int xieerukkehuuxinnxi(FILLE * pff,Pkkehuu cuustoom);int huoodennkeffangg(Pffanggjiaanzhhonggleii suub_ttreee,innt nnum_rooom);/*获获取nuum_rroomm个房间间*/intxiuugaiikehhuxiinxii(Pkkehuu pCCu);/*修修改客户户信息*/int xiuugaiikeffanggxinnxi(Pfaangjjiann pRR
23、F);/*修修改房间间信息*/int Colllecct(iint (* Commp)(voiid *,vooid *),intt nuum);/*按按照Coomp规规则收集集前nuum个信信息*/int jiyyushhijiian(voiid *,vooid *);/*按按照次数数规则*/int jiyyujiiagee(vooid *,vvoidd *);/*按照价价格规则则*/int Dissplaay(vvoidd);int Gett_Innfo(chaar * * szTTitlles,chaar * * buffferr,innt nnum);int zhaanxiiankkeh
24、uu(Pkkehuu pCCu);int zhaanxiiankkefaang(Pfaangjjiann pRRF);int huoodekkehuuxinnxi(Pkeehu pCuu);int souusuookeffanggzhoongllei(Pfaangjjiannzhoongllei pRSST);/*搜搜索一个个类型*/int souusuookeffanggxinnxi(Pfaangjjiannzhoongllei pRSST);/*搜搜一个房房间*/int souusuookehhu(PPfanngjiianzzhonngleei ppRSTT);/*搜一一个客户户*/int
25、 tiaanjiiazhhonggleii(Pffanggjiaanzhhonggleii pRRST);/*插入*/int tiaanjiiakeefanng(PPfanngjiianzzhonngleei ppRSTT);int tiaanjiiakeehu(Pfaangjjiannzhoongllei pRSST);int shaanchhuzhhonggleii(Pffanggjiaanzhhonggleii * pRSST);/*删删除*/int shaanchhukeefanng(PPfanngjiianzzhonngleei * pRRST);int shaanchhukeehu
26、(Pfaangjjiannzhoongllei * ppRSTT);int xiuugaiikeffanggzhoongllei(Pfaangjjiannzhoongllei pRSST);/*修修改*/int xiuugaiikehhu(PPfanngjiianzzhonngleei ppRSTT);int huoodekkefaangxxinxxi(PPfanngjiian pRFF);intBuff_Cllearr(vooid);intBuff_Fiill_Treee(PPfanngjiianzzhonngleei ppRSTT_teemp);/*Qssortt*/voidd Qssor
27、tt(vooid * * arrrayy,innt llow,intt hiigh,intt (*Commp)(voiid * ,vvoidd * );/*快速速排序法法排序,基基于比较较*/Buf Buff_Rooom;/*调试试信息*/#deffinee DEEBUGG #deffinee DEEBUGG2 #deffinee DEEBUGG3(xx) DEBUUG#enddifint Buff_Cllearr(vooid)Buff_Rooom.Buffsizze=00;retturnn 0;int Buff_Fiill_Treee(PPfanngjiianzzhonngleei ppHe
28、aad)Pfaangjjiann pRRoomm;forr(pRRoomm=pHHeadd-ffirsst;ppRooom;ppRooom=ppRooom-nexxt)BBuf_Rooom.BBuffferBuff_Rooom.Buffsizze+=ppRooom;retturnn 0;int huoodekkefaangzzhonngleei(FFILEE * pf,Pfaangjjiannzhoongllei subb_trree)if(!feeof(pf)frreadd(suub_ttreee,siizeoof(ffanggjiaanzhhonggleii),11,pff);if(!fe
29、eof(pf)reeturrn 11;elssereeturrn 00;int huoodekkefaang(FILLE * pff,Pffanggjiaan rroomm)if(!feeof(pf)frreadd(rooom,sizzeoff(faangjjiann),11,pff);if(!feeof(pf)reeturrn 11;elssereeturrn 00;int huoodekkehuu(FIILE * ppf,PPkehhu ccusttom)if(!feeof(pf)frreadd(cuustoom,ssizeeof(cusstomm),11,pff);if(!feeof(p
30、f)reeturrn 11;elssereeturrn 00;int xieerukkefaang(FILLE * pff,Pffanggjiaanzhhonggleii suub_ttreee)retturnn fwwritte(ssub_treee,ssizeeof(fanngjiianzzhonngleei),1,ppf);int xieerukkefaangxxinxxi(FFILEE * pf,Pfaangjjiann rooom)retturnn fwwritte(rroomm,siizeoof(ffanggjiaan),1,ppf);int xieerukkehuuxinnxi(
31、FILLE * pff,Pkkehuu cuustoom)retturnn fwwritte(ccusttom,sizzeoff(keehu),1,pf);int tiaanjiiazhhonggleii(Pffanggjiaanzhhonggleii pRRST)chaar * szzTittless=HHow manny RRoomms?;intt i,numm;Pfaangjjiannzhoongllei pRSST2;forr(i=0;ppRSTT;pRRST=pRSST-nexxt,ii+)pRRST22=pRRST;pRSST2-neext=(Pffanggjiaanzhhongg
32、leii)maallooc(ssizeeof(fanngjiianzzhonngleei);pRSST=ppRSTT2-nexxt;priintff(%s,szTTitlles);scaanf(%dd,&numm);huoodennkeffangg(pRRST,numm);pRSST-zhoongllei=i+0;pRSST-nexxt=NNULLL;retturnn 0;#deffinee IRR_X 1000#deffinee IRR_Y 1000#deffinee IRR_CXX 1000#deffinee IRR_C 200int tiaanjiiakeefanng(PPfanngji
33、ianzzhonngleei ppRSTT)connst chaar * szzRooom=Whaat iis tthe typpe?;chaar BBufBUFFSIZZE;intt nuum,ii;Pfaangjjiannzhoongllei pRSST2;PfaangjjiannpRFF;Buff0=0;priintff(%s,szRRoomm);scaanf(%dd,&numm);forr(i=1,ppRSTT2=ppRSTT;inexxt,ii+);if(!pRRST22)reeturrn 00;pRFF=pRRST22-ffirsst;pRSST2-shhuliiangg+;whi
34、ile(pRFF-nnextt)pRRF=ppRF-neext;pRFF-nnextt=(PPfanngjiian)malllocc(siizeoof(ffanggjiaan);pRFF=pRRF-nexxt;huoodekkefaangxxinxxi(ppRF);pRFF-nnextt=NUULL;retturnn 0;#deffinee ICC_Y 1600#deffinee ICC_Y22 2220int tiaanjiiakeehu(Pfaangjjiannzhoongllei pRSST)connst chaar * szzTreee=Whaat iis tthe typpe?;co
35、nnst chaar * szzRooom=Whiich rooom;connst chaar * szzNamme=Thee naame;chaar RRoommBUUFSIIZE;intt tyype,i;Pfaangjjiannzhoongllei pRSST2;PfaangjjiannpRFF;Pkeehu pCuu;priintff(%s,szTTreee);scaanf(%dd,&typpe);priintff(%s,szRRoomm);scaanf(%ss,RRoomm);forr(i=1,ppRSTT2=ppRSTT;pRRST22-zzhonngleei!=typpe+0;p
36、RSST2=pRSST2-neext,i+);if(!pRRST22)reeturrn 00;pRFF=pRRST22-ffirsst;whiile(!sttrcmmp(ppRF-nuum,RRoomm)&pRFF)pRRF=ppRF-neext;if(!pRRF)reeturrn 00;pCuu=pRRF-Reccordd;whiile(pCuu-nnextt)pCCu=ppCu-neext;pCuu-nnextt=(PPkehhu)mmallloc(sizzeoff(keehu);pCuu=pCCu-nexxt;pCuu-nnextt=NUULL;pRFF-ttimees+;huoodek
37、kehuuxinnxi(pCuu);retturnn 0;int souusuookeffanggzhoongllei(Pfaangjjiannzhoongllei pRSST)connst chaar * szzTreee=Whiich typpe?;connst chaar * szzErrror=Caantt fiind thee Tyype;chaar BBufBUFFSIZZE;intt tyype;Buff0=0;priintff(%s,szTTreee);scaanf(%dd,&typpe);whiile(pRSST)iff(pRRST-zhhonggleii=ttypee+00
38、)BBuf_Cleear();BBuf_Filll_TTreee(pRRST);DDispplayy();rretuurn 1;pRRST=pRSST-nexxt;gettch();retturnn 0;int souusuookeffanggxinnxi(Pfaangjjiannzhoongllei pRSST)connst chaar * szzTreee=Whiich typpe?;connst chaar * szzRooom=Pleeasee innputt thhe ddoorrplaate;connst chaar * szzErrror=Caantt fiind thee Ty
39、ype,Caantt fiind thee Rooom;chaar BBuf22BUUFSIIZE;intt tyype,rooom;Pfaangjjiann pRRF;priintff(%s,szTTreee);scaanf(%dd,&typpe);priintff(%s,szRRoomm);scaanf(%dd,&rooom);whiile(pRSST)iff(pRRST-zhhonggleii=ttypee+00)ppRF=pRSST-firrst;wwhille(ppRF)if(!sttrcmmp(ppRF-nuum,BBuf22)zhaanxiiankkefaang(pRFF);re
40、tturnn 1;/*if*/pRFF=pRRF-nexxt;/*wwhille*/pprinntf(%ssn,szzErrror1);rretuurn 0;/*iff*/pRRST=pRSST-nexxt;/*whiile*/priintff(%snn,sszErrrorr0);gettch();retturnn 0;int souusuookehhu(PPfanngjiianzzhonngleei ppRSTT)connst chaar * szzNamme=Thee naame?;connst chaar * szzErrror=Caantt fiind thee onne;chaar BBufBUFFSIZZE;Pfaangjjiann pRRF;Pkeehu pCuu;Buff0=0;priintff(%s,szN