logo资料库

C语言课程设计-宾馆客房管理系统.doc

第1页 / 共17页
第2页 / 共17页
第3页 / 共17页
第4页 / 共17页
第5页 / 共17页
第6页 / 共17页
第7页 / 共17页
第8页 / 共17页
资料共17页,剩余部分请下载后查看
C 语言课程设计 《宾馆客房管理系统》 课程设计报告 宾馆客房管理系统 09 级电子信息工程(2)班 题 学 姓 目 号 名 同组成员 年级专业 指导教师 完成日期 2010 年 06 月 20 日 College of Physics and Electronic Information,Anhui Normal University 安徽师范大学物理与电子信息学院 - 1 -17
C 语言课程设计 报告目录 1.课题要求 2.课题分析 3.成员分工 4.程序流程图 5.程序代码及调试 6.小节及收获体会 7. 参考书籍: College of Physics and Electronic Information,Anhui Normal University 安徽师范大学物理与电子信息学院 - 2 -17
C 语言课程设计 一、课题要求:  某宾馆有 301、302、303、304、305 五个标准间,每个标准 间可住 2 人;  链表存储结构:姓名、性别、房号、后续指针,按房间号有 序;  能实现入住(注意性别)和退房,能按给定姓名、房号查询;  建议采用链表结构,但用其它方法实现也可。 二、课题分析: 本程序是针对宾馆客房管理所设计的系统软件。我们借助 C 语言 作为编写工具,以 TurboC 作为编译环境,以静态链表作为编写方法, 通过对系统库函数的选择调用以及对所写函数的有机整合,辅之以规 整的页面设计,从而完成课题内容的程序设计部分。 程序中我们定义了一个结构体 struct hotel,用它来存储用户 信息,并以他为操作对象实现其他功能。结构体中包括用户的姓名、 性别、(均为包含两个元素的一位字符数组)房号及后续指针。 程序中含有定义函数如下: Message、main、choice、live_in(包含 live_in_one、live_in_two)、 live_away、check_through。 主函数实现对 choice、live_in、live_away、check_through 的 声明以及选择性调用。Choice 是界面输出函数,Message 是住房信息 输出函数,live-in、live_away、check_through 分别是入住、退房、 College of Physics and Electronic Information,Anhui Normal University 安徽师范大学物理与电子信息学院 - 3 -17
C 语言课程设计 查 询 函 数 。 live_in 可 实 现 单 人 入 住 和 双 人 入 住 的 双 重 选 择 , check_through 可满足按姓名和房号查询的两种方式。通过对程序的 相应操作可以基本实现课题要求。 三 、成员分工: 袁家文负责 Message、main、Choice 函数,夏楠负责 Live_in、 Live in _one 和 Live in_two 函数,我负责 Live_away、Look_through 函数。 College of Physics and Electronic Information,Anhui Normal University 安徽师范大学物理与电子信息学院 - 4 -17
C 语言课程设计 四、程序流程图: 开始 定义静态链表 执行 main 函数 执行 choice 函数 调用 Iive_in 函数 调 用 live_away 函数 调用 look_through 函 数 调用 live_in_two 函数 调用 live_in_one 函 数 结束 College of Physics and Electronic Information,Anhui Normal University 安徽师范大学物理与电子信息学院 - 5 -17
C 语言课程设计 五、程序代码及调试: (1)代码: #include #include #include #define NULL 0 struct hotel { int num; char name[2][20]; char sex[2]; struct hotel *next; }; void message(struct hotel *p1) { textcolor(8); clrscr(); gotoxy(8,5); printf(" **********************************************************\n"); gotoxy(8,6); printf(" gotoxy(8,7); printf(" WELCOME TO OUR HOTEL\n"); **********************************************************\n"); gotoxy(8,8); printf(" \n"); gotoxy(8,10); printf(" * roomnum name1 sex1 name2 sex2 * %d %s %c %s %c \n",p1->num,p1->name[0],p1->sex[0],p1->name[1],p1->sex[1]); p1=p1->next; gotoxy(8,12); printf(" * %d %s %c %s %c \n",p1->num,p1->name[0],p1->sex[0],p1->name[1],p1->sex[1]); p1=p1->next; gotoxy(8,14); printf(" * %d %s %c %s %c \n",p1->num,p1->name[0],p1->sex[0],p1->name[1],p1->sex[1]); p1=p1->next; gotoxy(8,16); printf(" * %d %s %c %s College of Physics and Electronic Information,Anhui Normal University 安徽师范大学物理与电子信息学院 %c - 6 -17
C 语言课程设计 \n",p1->num,p1->name[0],p1->sex[0],p1->name[1],p1->sex[1]); p1=p1->next; gotoxy(8,18); printf(" * %d %s %c %s %c \n",p1->num,p1->name[0],p1->sex[0],p1->name[1],p1->sex[1]); gotoxy(8,20); printf(" **********************************************************\n"); } void main() { void choice(struct hotel *p2); void live_in(struct hotel *p3); void live_away(struct hotel *p4); void check_through(struct hotel *p5); struct hotel *p,*head,a,b,c,d,e; int i; a.num=301; b.num=302; c.num=303; d.num=304; e.num=305; a.name[0][0]=a.name[1][0]=b.name[0][0]=b.name[1][0]=c.name[0][0]=c.name[1][ 0]=d.name[0][0]=d.name[1][0]=e.name[0][0]=e.name[1][0]='\0'; a.sex[0]=a.sex[1]=b.sex[0]=b.sex[1]=c.sex[0]=c.sex[1]=d.sex[0]=d.sex[1]=e.s ex[0]=e.sex[1]=' '; head=&a; a.next=&b; b.next=&c; c.next=&d; d.next=&e; e.next=NULL; p=head; choice(p); } void choice(struct hotel *p2) { struct hotel *pt; int x; textcolor(5); clrscr(); gotoxy(10,5); printf(" *********************************************\n"); College of Physics and Electronic Information,Anhui Normal University 安徽师范大学物理与电子信息学院 - 7 -17
C 语言课程设计 * * * 1.To Live In \n"); 2.To Live Awway \n"); 3.To Look Through \n"); Please Insert The Number To Choose The Sevice\n"); **********************************************\n"); gotoxy(10,7); printf(" gotoxy(10,9); printf(" gotoxy(10,11); printf(" gotoxy(10,13); printf(" gotoxy(10,15); printf(" scanf("%d",&x); switch(x) { case 1:live_in(p2);break; case 2:live_away(p2);break; case 3:check_through(p2);break; } } void live_in(struct hotel *p3) { void live_in_two(struct hotel *p3_1); void live_in_one(struct hotel *p3_2); struct hotel *pt; int x,m; char str[20],ch,str1[20],ch1;clrscr(); textcolor(4); pt=p3; while(1) {printf(" Are you contiune to live in?\n 1.YES\n 2.NO\n"); scanf("%d",&m); switch(m) { case 1:{ In\n"); printf(" Choose The Room That You Want To Live scanf("%d",&x); if(x>300&&x<306) { while(pt->num!=x) { } pt=pt->next; if(pt->sex[0]==' '||pt->sex[1]==' ') 安徽师范大学物理与电子信息学院 College of Physics and Electronic Information,Anhui Normal University - 8 -17
分享到:
收藏