酒店住房信息管理系统.docx

上传人:小飞机 文档编号:2034428 上传时间:2023-01-02 格式:DOCX 页数:34 大小:142.18KB
返回 下载 相关 举报
酒店住房信息管理系统.docx_第1页
第1页 / 共34页
酒店住房信息管理系统.docx_第2页
第2页 / 共34页
酒店住房信息管理系统.docx_第3页
第3页 / 共34页
酒店住房信息管理系统.docx_第4页
第4页 / 共34页
酒店住房信息管理系统.docx_第5页
第5页 / 共34页
点击查看更多>>
资源描述

《酒店住房信息管理系统.docx》由会员分享,可在线阅读,更多相关《酒店住房信息管理系统.docx(34页珍藏版)》请在三一办公上搜索。

1、酒店住房信息管理系统一、题目(问题)描述模拟酒店住房信息管理系统程序,进入系统,目录有登记入住,查询房间入住,查询当前费用,结账退房,帮助说明,关于,保存当前信息,退出系统。系统中包括各种信息,程序运行结果正确,操作方便,逻辑层次清晰。如图1解:图1 酒店住房信息管理系统二、功能分析通过体验并分析后得出酒店住房信息管理系统主要功能包括:1.登记入住;2.查询房间入住; 3.查询当前费用;4.结账退房;5.帮助说明;6.关于; 0.退出.三、系统设计1程序总体结构程序中由主模块负责协调各功能模块的工作。进入程序后,根据输入操作,执行相应的读入、查询、排序、增加、删除、显示当前信息、保存、显示平均

2、成绩、退出等功能,并在屏幕上输出。酒店信息管理系统登记入住查询当前费用查询房间入住结账退房帮助说明关于退出 图2 酒店住房信息管理系统的总体结构图2.界面设计 如图3,下面的Choose:表示通过选择1、2、3、4、5、6、0等来进入各项功能,从而实现程序对信息的管理。 图3 管理信息界面3输入方式设计此程序为dos下程序,因此简化为键盘控制。1、2、3、4、5、6、0分别表示各项功能。回车表示确认进入各个程程序;主页面开始之后,键入:1.登记入住;2.查询房间入住;3.查询当前费用;4.结账退房;5.帮助说明;6.关于;0.退出.4重要数据的数据结构设计酒店住房信息管理系统结构typedef

3、 struct tm tm; /*struct tm命名为tm*/ typedef struct node /*把struct 命名为node*/void *elem; /*无类型指针类型成员*/struct node *next; /*指针类型成员存放*/ node_t; /*指针地址*/ typedef struct room /* 房间结构 */int room_number; /*房间号 */Bool room_is_used; /*房间已使用*/Type room_kind; /*房间种类*/ char guest_name20; /*客人姓名*/char guest_Id19; /

4、*省份证号*/ double room_price; /*房间价格*/tm *start_time; /*入住时间*/tm *end_time; /*退房时间*/double total_cost; /*合计消费金额*/ room_t;5函数设计文件中函数的功能如下:文件名函数原型函数功能“filemenu.c”void welcome()显示欢迎页面void menu()主菜单页面void locate position();定位光标void animal();显示一个小动画void animation();显示另一动画void menu();菜单项void goodbai()完成时退出程序

5、void pricei nfo()显示房间价格四、关键技术、难点及其解决方法此程序的关键是是否有保存功能,而且是保存把信息保存到文件中后退出程序,当再次进入程序是是否能查找到上次登陆是录入的信息,还有就是当系统要查找、删除信息是如何确定程序中是否有你要查找、删除的信息,来验证系统中是否存在所要的信息。五、测试方法1.按键测试。检查正确的输入时,是否界面正确表现;错误输入时,是否无效。2.程序运行测试。正确运行,观察是否异常;运行时中断,程序是否正确退出。六、总结通过这次课程设计,使我受到了一次用专业知识、专业技能分析和解决问题的全面系统的锻炼。对一些基础知识有了更规范的认识。让我理解到结构化设

6、计相关知识在实际方面的应用的操作,让我更深刻理解的“自顶向下,逐步细化的”思想;模块设计,多个函数并用;代码的重要性及注释的关键性。使我在综合知识的选用方面,在应用软件开发的基本思想、方法方面,以及在常用编程设计思路技巧的掌握方面都能向前迈了一大步。 此外,我深深地体现到进行软件开发不是一件简单的事情,它需要设计者具有全面的专业知识、缜密的思维、严谨的工作态度以及较高的分析问题、解决问题的能力,而我在很多方面还有欠缺。最后,我要衷心感谢老师在我的设计过程中给予我的极大帮助,使我能够及时、顺利地完成此次的课程设计。同时,也要感谢我的指导老师和同学们在本系统的设计过程中给予我的支持和帮助。附1、使

7、用说明:1.功能说明.此程序分为7个选项,分别是登记入住、查询房间入住、查询当前费用、查询当前费用、结账退房、帮助说明、关于、退出等功能,当选1时是进入登记入住功能,2是进入查询房间入住功能,3是进入查询当前费用功能,4是结账退房功能、5是显示帮助说明功能、6是显示关于的信息功能,0是退出系统功能。2.用户手册. .显示主菜单后键入数字: 1.登记入住;2.查询房间入住;3.查询当前费用;4.结账退房;5.帮助说明;6.关于;0.退出.附2、代码清单*l “filemenu,c” *#include #include #include #include #include #include #i

8、nclude #include #define ROOM_MAX 100#define TYPE_NUM 4#define WIDTH 80#define HIGH 25typedef struct tm tm;typedef enum False, True Bool;typedef enum Single, Standard, Vip, President Type;typedef struct nodevoid *elem;struct node *next; node_t;/* 房间结构 */typedef struct roomint room_number;Bool room_is

9、_used;Type room_kind;char guest_name20;char guest_Id19;double room_price;tm *start_time;tm *end_time;double total_cost; room_t;void welcome();void menu();void locate_position();void animal();void animation(int x);void goodbye();node_t *list_init();node_t *list_add(node_t *head, void *elem);node_t *l

10、ist_del(node_t *head, node_t *dest);node_t *list_for_each(node_t *head, void *(*func)(node_t *head, node_t *cur, void *arg),void *arg);node_t *list_reverse(node_t *head);void list_destory(node_t *head);void *mprint(node_t *head, node_t *cur, void *arg);void *madd(node_t *head, node_t *cur, void *arg

11、);void *mdel(node_t *head, node_t *cur, void *arg);void room_add(node_t *head, room_t hotalTYPE_NUMROOM_MAX);void room_del(node_t *head);void price_info();int increase_two(int i);double price_of_room(Type kind);char *Type_to_string(Type kind);char *Bool_to_string(Bool _bool_);room_t *get_first_room(

12、room_t hotalROOM_MAX, Type kind);/* increase_two* * i 要自增的数* 调用一次增加 2*/int increase_two(int i)return i+2;/* price_of_room* * kind 房间类型* 根据房间的类型得到房间的单价*/double price_of_room(Type kind)return pow(2, (int)kind) * 100;/* 定位光标* x 要定位的列数* y 要定位的行数* 无返回值* 调用API,定位光标位置,比用空格,Tab, 回车定位方便许多*/void locate_positi

13、on(int x, int y)COORD C;C.X = x;C.Y = y;SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), C);/* welcome* 显示欢迎界面 (总菜单界面的大部分内容)* 列出用户可进行的操作* 每次任务完成后,再次调用些界面*/void welcome()int position = 4;locate_position(25, 3);printf(酒店房间登记与计费管理系统);locate_position(30, position = increase_two(position);printf

14、(1: 登记入住);locate_position(30, position = increase_two(position);printf(2: 查询房间入住);locate_position(30, position = increase_two(position);printf(3: 查询当前费用);locate_position(30, position = increase_two(position);printf(4: 结账退房);locate_position(30, position = increase_two(position);printf(5: 帮助说明);locate

15、_position(30, position = increase_two(position);printf(6: 关于);locate_position(30, position = increase_two(position);printf(0: 退出);locate_position(27, position = increase_two(position);printf(请选择要办理的业务n);void goodbye()char is_leave = i;char str15 = color 0;char str_color2;int color;time_t tTime;tm *t

16、Block;locate_position(33, 10);printf(确认退出(Y/N)?);while (is_leave != Y & is_leave != N)is_leave = kbhit() ? toupper(getch() : m;animal(1);animation(6);animal(18);animation(19);animal(20);animation(21);animal(22);animation(23);strcpy(str, color 0);color = rand() % 8 + 8; itoa(color,str_color, 16);strc

17、at(str, str_color);system(str);locate_position(29,4);tTime = time(NULL);tBlock = localtime(&tTime);printf(%s %2d:%02d:%02d, _DATE_, tBlock-tm_hour, tBlock-tm_min, tBlock-tm_sec);locate_position(33, 10);printf(确认退出(Y/N)?);_sleep(1000);if (toupper(is_leave) = Y)locate_position(30, 13);printf(谢谢使用,欢迎下次

18、来访!);locate_position(0,0);getch();exit(0);elsesystem(cls);menu();/* price_info* 无参数,显示房间的价格*/void price_info()int position = 1;int weidth = 20;printf(n房间的收费如下-);locate_position(weidth, position = increase_two(position);printf(1: %-20s单 间%10.2f, Type_to_string(Type)0), price_of_room(Type)0);locate_po

19、sition(weidth, position = increase_two(position);printf(2: %-20s标 准 间%10.2f, Type_to_string(Type)1), price_of_room(Type)1);locate_position(weidth, position = increase_two(position);printf(3: %-20s房 间%10.2f, Type_to_string(Type)2), price_of_room(Type)2);locate_position(weidth, position = increase_two

20、(position);printf(4: %-20s总 统 套 房%10.2f, Type_to_string(Type)3), price_of_room(Type)3);locate_position(weidth + 6, position = increase_two(position);printf(从中午十二点到第二天中午十二点算一天n);locate_position(weidth + 12, position = increase_two(position);printf(不足一天按一天算);_sleep(3000);/* animation* 展示一个小动画*x 在第几行展示

21、 *其中随着时间流逝, 不断的向右移动*/void animation(int x)static int i = 1;locate_position(1, x);printf( =);locate_position(i % (WIDTH-5), x);printf();i += 3;if (i WIDTH - 5)i = 1;/* 和上面的函数相似,这次是向左*/void animal(int x)static int i = 74;locate_position(1, x);printf( -);locate_position(i % (WIDTH-5), x);printf();i -=

22、5;if (i 0)i = WIDTH - 6;/* menu* 菜单项* * 没有参数,显示菜单界面* 根据不同的选项,进入不同的子模块*/void menu()int color;int i = 0, j;char str15;char str_color2;char ch = m;time_t tTime;tm *tBlock;room_t hotalTYPE_NUMROOM_MAX;node_t *head = list_init();memset(&hotal, 0, sizeof(room_t) * TYPE_NUM * ROOM_MAX);/* 初始化房间信息 */for (i

23、= 0; i TYPE_NUM; i+)for (j = 0; j tm_hour, tBlock-tm_min, tBlock-tm_sec);locate_position(48, 20);_sleep(1000);/* list_init* 初始化链表,这个链表为循环链表, 有头结点*/node_t *list_init()node_t *head = (node_t *)malloc(sizeof(node_t);head-elem = NULL;head-next = head;return head;/* list_add* 向链表里面添加结点* * head 链表的头结点* el

24、em 结点中的数据* 此列表为尾插法*/node_t *list_add(node_t *head, void *elem)node_t *new_node = (node_t *)malloc(sizeof(node_t);new_node-elem = elem;new_node-next = head-next;head-next = new_node;return new_node;/* list_del* 删除列表中的元素* * head 列表的头结点* dest 要删除的结点* 给出要删除的结点,从头结点开始找到要删除的结点,然后删除* 表头元素不能删除*/node_t *list

25、_del(node_t *head, node_t *dest)node_t *pre = head;node_t *cur = pre-next;while (cur != dest)if (cur != head)pre = pre-next;cur = cur-next;elsereturn head;pre-next = cur-next;/* 释放指针后直接赋值为 NULL, 预防 野指针 * free(cur);* cur = NULL; * 但是这个地方不能free了,因为它的元素包含有房间数组*而房间还是要用的。所以就不能消了。*/return pre-next;/* list

26、_for_each* 遍历链表* * head 链表头结点* func 函数指针,对不同的遍历进行不同的操作* arg 参数, 有时候可以不用,主要是为了向func所指向的函数传递参数*/node_t *list_for_each(node_t *head,void *(*func)(node_t *head, node_t *cur, void *arg), void *arg)node_t *cur = head-next;while (cur != head)func(head, cur, arg);cur = cur-next;return head;/* list_reverse*

27、反转链表*head 要转的链表的表头结点*链表调换过来,原来的表头现在为表尾,不过对于循环链表来说这个操作很简单*/node_t *list_reverse(node_t *head)node_t *pre = head;node_t *cur = pre-next;node_t *nxt = cur-next;while (cur != head)cur-next = pre;pre = cur;cur = nxt;nxt = nxt-next;cur-next = pre;return head;/* list_destory* 销毁链表*head 要销毁链表的表头结点*程序退出前可以把链

28、表销毁*/void list_destory(node_t *head)node_t *cur = head-next;while (cur != head)head-next = cur-next;free(cur);cur = cur-next;free(head);/* mprint* 打印结点的内容*head 链表的头结点本函数不用,为了给list_for_each 调用*cur 要打印的当前结点*arg 占位*/void *mprint(node_t *head, node_t *cur, void *arg)printf(%dt%-15s%-10s%-20stt%4.2f(元/天)

29、n,(room_t *)(cur-elem)-room_number,Type_to_string(room_t *)(cur-elem)-room_kind),(room_t *)(cur-elem)-guest_name,(room_t *)(cur-elem)-guest_Id,(room_t *)(cur-elem)-room_price);return NULL;/* mdel* 删除给定 元素内容 的结点* head 链表的头结点* cur 要删除的结点* arg 要删除结点中的一项内容* 通过arg, 找到要删除的结点,再调用list_del删除结点*/void *mdel(no

30、de_t *head, node_t *cur, void *arg)if (room_t *)(cur-elem)-room_number = *(int *)arg)list_del(head, cur);return NULL;/* Bool_to_string* _bool_ 将给定的ool类型变量返回tring值用于输出*/char *Bool_to_string(Bool _bool_)switch (_bool_)case False: return False;case True: return True;default: return NULL;/* Type_to_stri

31、ng* kind 将给定的ype类型变量返回tring值用于输出*/char *Type_to_string(Type kind)switch (kind)case Single: return Single;case Standard: return Standard;case Vip: return Vip;case President: return President;default: return NULL;/* get_first_room* 得到第一个为空的房间*hotal 房间数组*kind 哪一种类型的房间*/room_t *get_first_room(room_t hot

32、alROOM_MAX, Type kind)int i;for (i = 0; i room_is_used)return hotal;return NULL;/* room_add* 将要住处的房间添加到房间链表里面。*hoad 链表头*hotal 整个酒店的房间* 首先由房客确定要居住的房间类型*根据类型,调用get_first_room得到第一个没有居住的房间*再把房间信息填完整,最后加入到房间链表里面。*/void room_add(node_t *head, room_t hotalTYPE_NUMROOM_MAX)int position = 1;Type kind;time_t

33、timer = time(NULL);room_t *room_dest;locate_position(30, position = increase_two(position);printf(一共有四种类型的房间nn);locate_position(25, position = increase_two(position);printf(1: Single 单 间);locate_position(25, position = increase_two(position);printf(2: Standard 标 准 间);locate_position(25, position = i

34、ncrease_two(position);printf(3: Vip 房 间);locate_position(25, position = increase_two(position);printf(4: President 总 统 套 房);locate_position(25, position = increase_two(position);printf(0: Esc 取消n);locate_position(25, position = increase_two(position);printf(请选择要居住的类型,按0取消本次操作:n);locate_position(30, position = increase_two(position);scanf(%d, &kind);/* 用户选择取消,则直接退出*/if (!kind)return;/* 因为输入的类型比房间类型大1 所以要减 1 */room_dest = get_first_room(hotalkind-1, kind-1);room_dest-room_is_used

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 生活休闲 > 在线阅读


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号