没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
悠悠同学网 www.uuclass.com
酒店管理系统 C++源代码----仅供参考学习,切勿用于任何商业用途
# include <iostream.h>ﻫ# include <fstream.h>ﻫ# include <process.h>ﻫ# in
clude <string.h>ﻫ# include <stdlib.h>ﻫ# include <stdio.h>ﻫ# include <ctype.h>
# include <conio.h>ﻫ# include <dos.h>ﻫ//*****************************************
************************ﻫﻫﻫﻫ//***************************************************
**************ﻫ// CLASS NAME : MENUﻫ// DETAILS
一 需求分析1( ﻫ)顾客1 ﻫ 查看房间信息(空房号,
等级,床位数)2 ﻫ 入住(房号,姓名,身份证)3 ﻫ 退
房(结账)2( ﻫ) 管理员
1 查看房间信息(空房号,房间状态,等级,床位数)ﻫ
2 入住(房号,改变房间状态,登记人)
3 退房(结账,登记人)ﻫ
ﻫ二 实体1 ﻫ 房间::ﻫ 号码 c_roomﻫ 等
级 c_dank
床数 c_nbedﻫ 状态 c_statds
价格 c_rate
2 ﻫ 顾客::
身份证 idﻫ 人数 m ﻫ 要求等级
rﻫ 入住房间 room
//这个时候不知道是设计类还是功能模块
ﻫ三 程序流程
1. 管理员登陆
2. 选择功能
1. 登记入住 void check_in();
2. 退房 void check_out();
3. 定房 void book();
4. 订房
3. 管理员退出
四 功能模块
1 顾客模块1 ﻫ)登记入住1 ﻫ 输入人数 m 和房
间等级要求 r2 ﻫ 按 r 搜索空房 再按 m 搜索
3 如果有符合条件的显示4 ﻫ 如果没有则
给出优化方案
5 选择房间6 ﻫ 给出每个人每天要付的
费用dayrent 7 ﻫ 登记个人信息8 ﻫ 改变房间
状态
2)退房
1 计算每人应付费用和总共费用2 ﻫ 改变
房间状态3 ﻫ)订房1 ﻫ 输入人数 m 房间等级要
求r2 ﻫ 按 r 搜索空房 再按 m 搜索 3 ﻫ 如果
有符合条件的显示4 ﻫ 如果没有则给出优化方案
悠悠同学网 www.uuclass.com
5 ﻫ 选择房间2 ﻫ 管理员模块1 ﻫ)登录系统
1 输入用户名和密码2 ﻫ 检验密码
3 ﻫ 通过/重新输入
2)登记入住(同上)
3)退房(同上)4 ﻫ)订房(同上)5 ﻫ)房间信息
管理1 ﻫ 显示空房及对应的等级空房
2 ﻫ 显示已订房号码及开始入住日期
: IT CONTROLS OVER ALL THE FUNCTIONSﻫ//********************************
*********************************ﻫclass menuﻫ{ﻫ public :ﻫ void main_men
u(void);ﻫ void startup(void);ﻫ void box(void);ﻫ v
oid line_hor(int, int, int, char);ﻫ void line_ver(int, int, int, char);ﻫ}
;ﻫﻫ//*****************************************************************
// CLASS NAME : HKEEPﻫ// DETAILS : IT CONTROLS OVER ALL
FUNCTIONS
// RELATED TO HKEEPﻫ//*****************************
************************************
ﻫclass hkeepﻫ{ﻫ public :
hkeep(void);ﻫ ~hkeep(void);ﻫ void add(void);
ﻫ void modify(void);
void deletion(void);ﻫ void display_list(void);ﻫﻫ pri
vate :ﻫ void display_record(int);ﻫ int found_record(in
t);
void delete_record(int);ﻫ void modify_record(int)
;
int recordno(int);ﻫ int last_code(void);ﻫ int
code;ﻫ char name[20],roomno[10],order[99];
};
//*****************************************************************
// CLASS NAME : MENU
// FUNCTION NAME : LINE_HORﻫ// DETAILS : IT ACCEPTS THE ROWS AND
COLUMNS ANDﻫ// DRAWS HORIZONTAL LINESﻫ//*************
****************************************************ﻫ
void menu :: line_hor(int column1, int column2, int row, char c)ﻫ{ﻫ for(c
olumn1;column1<=column2;column1++)ﻫ{ ﻫ //gotoxy(column1,row);ﻫ
cout<<c;ﻫﻫﻫﻫ}ﻫ} ﻫ
//**************************************************************
***ﻫ// CLASS NAME : MENUﻫ// FUNCTION NAME : LINE_VERﻫ// DETAILS
: IT ACCEPTS ROWS AND COLUMNS AND
// DRAWS THE VERTICAL LINEﻫ//**************************************
***************************ﻫﻫvoid menu :: line_ver(int row1, int row2, int
悠悠同学网 www.uuclass.com
column, char c)ﻫ{ﻫ for(row1;row1<=row2;row1++)ﻫ{ ﻫ gotoxy(col
umn, row1);ﻫ cout << c;
}ﻫ}
//****************************************************************
*ﻫ// CLASS NAME : MENUﻫ// FUNCTION NAME : STARTUPﻫ// DET
AILS : IT CREATES THE STARTING SCREEN
//*****************************************************************ﻫvoid menu ::
startup(void)ﻫ{ﻫ// clrscr();
int i,j,s;ﻫ char a[] = " H*O*T*E*L";ﻫ char b[] = " M*A*N*A*G*E*M*E*N*T";
for(i=0;i<=79;i++)ﻫ line_ver(1,25,i,179);
// gotoxy(1,11);clreol();
gotoxy(1,13);clreol();ﻫ j = 63;ﻫ s = 100;
for(i=1;i<=43;i++)
{ﻫ sound(s);
s = s+20;
delay(50);ﻫ gotoxy(1,12);
clreol();ﻫ gotoxy(i,12);ﻫ cout<<b;ﻫ gotoxy(j,12);
ﻫ cout<<a;ﻫ j--;ﻫ gotoxy(1,1);ﻫ} ﻫ// nosound();
delay(100);ﻫ char ch = 219;ﻫ s = 500;ﻫ for(i=0;i<=79;i
++)ﻫ{ ﻫ sound(s);ﻫ s =s+10;ﻫ gotoxy(i,10);ﻫ cout<<ch;
delay(5);ﻫ} ﻫ nosound();ﻫ delay(200);ﻫ ch = 219;ﻫ s = 1
290;ﻫ for(i = 79; i>=1;i--)ﻫ{ ﻫ sound(s);ﻫ s = s- 10;ﻫ goto
xy(i,14);ﻫ cout<<ch;ﻫ delay(5);ﻫ} ﻫ nosound();ﻫ delay(1000);
clrscr();ﻫ cout<<"\n\n\n\n\n\n\n\n\n\n\n\t\t\t\tProject made by :";
char jklf[]="ABCDEF";ﻫ cout<<"\n\n\t\t\t\t\t\t";ﻫ for(int u=0;u<7;u++)
ﻫ { cout<<jklf;ﻫ delay(80);ﻫ }
char jklf1[]=" GHIJK :";
cout<<"\n\t\t\t\t\t\t";ﻫ for(int v=0;v<7;v++)ﻫ { cout<<jklf
1[v];ﻫ delay(80);ﻫ }
char jklf2[]="��������";
cout<<"\n\t\t\t\t\t\t";
for(int w=0;w<5;w++)
{ cout<<jklf2[w];
delay(80);ﻫ} ﻫ delay(1100);ﻫﻫ} ﻫ//*****************************
************************************ﻫ// CLASS NAME : MENU
// FUNCTION NAME : BOXﻫ// DETAILS : IT CREATS BOX FOR THE MENU
//*****************************************************************ﻫﻫvoid
menu :: box(void)ﻫ{ﻫ // line_hor(2,39,1,219);
line_hor(2,39,24,219);ﻫ line_ver(1,24,2,219);
line_ver(1,24,39,219);ﻫ}
ﻫ//*****************************************************************
// CLASS NAME : MENUﻫ// FUNCTION NAME : MAIN_MENUﻫ// DETAI
LS : IT CREATES MENU AND CONTROLS OTHERﻫ// FUNCTIO
悠悠同学网 www.uuclass.com
Nﻫ*****************************************************************//ﻫvoid menu
:: main_menu(void)ﻫ{ﻫ char ch;ﻫ while (1)ﻫ {
clrscr();ﻫ textmode(C40);ﻫ clrscr();ﻫ box();
gotoxy(12,5);ﻫ cout<<" House Keeping ";ﻫ gotoxy(12,6);
ﻫ cout<<"-----------------";ﻫ gotoxy(12,10);ﻫ cout<<" 1 : Store Cust
omer Order";ﻫ gotoxy(12,11);ﻫ cout<<" 2 : Display custom
er Order";ﻫ gotoxy(12,12);ﻫ cout<<" 3 : Delete Order";
ﻫ gotoxy(12,13);
cout<<" 4 : Modify Order";ﻫ gotoxy(12,14);ﻫ cout<<" 0 : Quit";
ﻫ gotoxy(11,18);ﻫ cout<<" Enter your choice";ﻫ ch = getch();
textmode(C80);ﻫ clrscr();ﻫ if ( ch == '1')
{
hkeep d;ﻫ d.add();ﻫ} ﻫ elseﻫ if ( ch == '2'
)
{
hkeep d;ﻫ d.display_list();
}ﻫ else
if ( ch == '3')ﻫ{ ﻫ hkeep d;ﻫ d.deletion
();ﻫ} ﻫ elseﻫ if( ch == '4')ﻫ{ ﻫ hkeep d;
ﻫ d.modify();
}ﻫ else
if(ch == '0')ﻫ break;ﻫ}ﻫ} ﻫ//*************************************
****************************ﻫ// CLASS NAME :HKEEPﻫ
// FUNCTION NAME : HKEEP (CONSTRUCTOR)
// DETAILS : IT IS A CONSTRUCTOR FUNCTION, GIVING
// DEFAULT VALUES
//*****************************************************************
hkeep :: hkeep (void)
{ﻫﻫ code = 0;ﻫ name[0] = '\0';ﻫ roomno[0] = '\0';ﻫ order[0] = '\0';ﻫ}ﻫ//***
**************************************************************
// CLASS NAME : HKEEPﻫ// FUNCTION NAME : ~HKEEP (DESTRUCTOR)ﻫ/
/ DETAILS : IT IS A DESTRUCTOR FUNCTIONﻫ//*****************
************************************************ﻫ
hkeep :: ~hkeep (void)ﻫﻫ}ﻫ{ﻫ//*******************************************
**********************ﻫ// CLASS NAME : HKEEP
// FUNCTION NAME : DISPLAY_LIST
// DETAILS : IT DISPLAYS LIST OF THE PERSON'S
// RECORDSﻫ//*************************************************
****************ﻫ
void hkeep:: display_list(void)
{ﻫ clrscr();
menu m;ﻫ char *t_name, *t1_name = NULL;ﻫ gotoxy(3,5);ﻫ cout<<" Ente
r the character(s) for selective list ";ﻫ gotoxy(3,6);ﻫ cout<<" or press
<ENTER> for whole list or '0' to exit : ";ﻫ gets(t_name);ﻫ if (t_name[0] == '
悠悠同学网 www.uuclass.com
0')
return;ﻫ int len = strlen(t_name);ﻫ clrscr();ﻫ fstream file;
file.open("HKFILE.IMR", ios :: binary | ios :: in);
file.seekg(0, ios :: beg);ﻫ int row = 4;ﻫ int found = 0;ﻫ int page
no = 1;ﻫ int flag = 1;ﻫ char ch;ﻫ gotoxy(1,2);ﻫ cout<<" Order Serial
No.";ﻫ m.line_hor(1,79,3,196);ﻫ m.line_hor(1,79,24,196);ﻫ whil
e (file.read((char *)this , sizeof (hkeep)))
{ﻫ flag = 1;ﻫ for(int i=0;i<len;i++)
t1_name
=
n
ame
;
�
t
1_
n
a
me[
le
n]
= '\0'
;�
if(st
r
cmp
i(
t_name
,
t1_na
m
e)
==
0
)�{
�
d
e
lay(
2
00)
;
�
f
o
un
d
= 1
;
�
goto
x
y(
1
,row);�
c
out<<
c
ode;
go
to
xy(7,row);
pu
t
s(n
a
me);�
go
t
ox
y
(
2
7
,
r
o
w);�
co
u
t
<
<" R
o
o
m
no.
:"<
<ro
o
mno;
got
o
xy(27,row
+1);
�
cout<<" Or
de
r
:
";�
p
uts(o
rd
er
)
;�
if(
row
=
=
22)
�{ �
fl
ag
=
0
;
row =
4;� g
o
t
o
xy(
6
6,1);�
co
ut<
<
"
P
a
ge No
.
:
"
<<pageno
;
�
p
age
no++;
�
goto
x
y(
1
,
25);
�
c
o
u
t<
<
"
P
r
e
s
s <
E
SC
>
to
e
xi
t
or any key
t
o c
o
n
ti
nue..
.
"
;�
ch
= g
e
t
c
h
(
);
i
f(
c
h
==
27
)
�
return
;
�
cl
rs
cr
(
);� g
o
tox
y(
1,2);
co
u
t<<
"
O
rde
r
Seria
l
N
o
.";
m.line
_
hor
(
1
,
7
9
,3,
1
96);�
m.
l
ine_ho
r(
1,
79,24,
1
96)
;�} �
e
lse�
r
o
w
= r
ow + 2;�
}
}�
if ( !f
o
u
nd
)
{
� sou
n
d(
5
00);�
d
ela
y
(100);� n
o
sound()
;
�
g
ot
ox
y(1,5);
co
ut
<
<
"R
e
c
ord
s not found" ;�
}
�
i
f (f
l
ag)�{ �
g
ot
o
xy(66
,
1
)
;
cou
t<<
"
age N
o.
: "
<
<pagen
o;
� g
ot
ox
y
(1,2
5
);�
c
out<
<"
re
s
s an
y
key t
o
cont
i
nu
e
..
."
;� getc
h
()
;
�} �
f
i
l
e
.
close
(
);�
}
/
/
**
*
*
*
*
*
*
*
******
*
**
*
******
*
*
*
*
*
**
*
*
***
***
*
****
**
***********
*
*
*
**
**
�// C
L
AS
S
N
AM
E
:
H
K
E
EP�
//
FUNC
T
ION NAME
: DISPLA
Y
_RECORD�
//
D
ET
AIL
S
:
I
T
D
I
S
P
LA
Y
S SI
N
GLE
RECORD FOR
TH
E�//
GIVEN RE
C
O
RD
/
/
**
**
*
*
*
***
*
*
**
*****
*
********
*
**
*
***
**
***
**
*********
**
**
*
******
*
**��vo
i
d
h
k
e
ep
:
:
disp
la
y_
recor
d(i
n
t
t_c
o
de)�{�
f
st
r
eam
f
ile;�
f
i
le
.
open(
"
H
KFI
LE.IMR
"
,ios :
:
bin
ar
y
| io
s
::i
n
);
f
i
l
e
.seek
g(0
,
i
os::be
g
)
;
w
h
il
e
( f
i
le.r
ead
((char
*)
t
h
is, si
z
eof(hke
e
p
)))
{
if(t_c
o
d
e
==
c
ode
)
�
{
�
g
otoxy(3
,3
);�
c
o
u
t<<
"
O
rd
er
s
er
ia
l
No
.
"<<code;�
go
t
oxy(3
,
5);
剩余58页未读,继续阅读
资源评论
ohmygodvv
- 粉丝: 506
- 资源: 2320
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功