酒店管理系统代码c语言版)
酒店管理系统源代码

酒店管理系统源代码#include<string.h>#include<stdlib.h>#include<stdio.h>#include<conio.h>typedef struct tagCustomer{char m_ID[19]; /*身份证号码*/ char m_name[10]; /*顾客姓名*/ int m_age; /*顾客年龄*/ char m_sex[6]; /*顾客性别*/ int num;}Customer;/*顾客结构*/typedef struct tagRoom{int m_num; /*房间号*/int m_floor; /*楼层*/int m_price; /*价格*/int m_use; /*是否已入住*/}Room;/*房间结构*/int i,j=0,age,num,floor,price,use,n;int reg =0;Customer cus[5];Room r[5];int count=5;char ID[18],name[10],sex[6];FILE *fproom;FILE *fpcustomer;void Customer_Input(){if(count<=5){printf("请输入身份证号(18位数字):");scanf("%s",&cus[j].m_ID);printf("请输入姓名(10位字符)");scanf("%s",&cus[j].m_name);printf("请输入年龄(数字型)");scanf("%d",&cus[j].m_age);printf("请输入性别(男或女):");scanf("%s",&cus[j].m_sex);}else{printf("\n 存储空间已满!");}printf("\n\r顾客可以住在:");printf("\n\r房间号楼层价格是否空闲(1:空闲0:已使用)");for(i=0;i<count;i++){if(r[i].m_use==1){printf("\n\r%d %d %d %d ",r[i].m_num,r[i].m_floor,r[i].m_price,r[i].m_use);}}printf("\n\r请你输入房间号:");scanf("%d",&num);reg = 0;for(i=0;i<count;i++){if(r[i].m_use==1&&r[i].m_num==num){r[i].m_use = 0;printf("\n 登记成功!\n");cus[j].num=r[i].m_num ;j=j+1;reg=1;}}if(reg==0){printf("\n 登记失败!\n");}}void Customer_ListOut(){if(count<=5){printf("请输入身份证号(18位数字):");scanf("%s",&ID);for(i=0;i<count;i++)if(strcmp(cus[i].m_ID,ID)==0){printf("\n\r顾客身份证号:%s 姓名:%s 年龄:%d 性别:%s \n",cus[i].m_ID,cus[i].m_name,cus[i].m_age,cus[i].m_sex);}}}else{printf("\n \n");}}void Room_ListOut(){printf("\n\r房间号楼层价格是否空闲(1:空闲0:已使用)");for(i=0;i<count;i++){if(r[i].m_use==1){printf("\n\r%d %d %d %d ",r[i].m_num,r[i].m_floor,r[i].m_price,r[i].m_use);}}}void PerCustomer_Search(){if(count<=5){printf("请输入身份证号(18位数字):");scanf("%s",&cus[j].m_ID);printf("请输入姓名(10位字符)");scanf("%s",&cus[j].m_name);printf("请输入年龄(数字型)");scanf("%d",&cus[j].m_age);printf("请输入性别(男或女):");scanf("%s",&cus[j].m_sex);}else{printf("\n 住房已满!");}printf("\n\r顾客可以预订:");printf("\n\r房间号楼层价格是否空闲(1:空闲0:已使用)");for(i=0;i<count;i++){if(r[i].m_use==1){printf("\n\r%d %d %d %d ",r[i].m_num,r[i].m_floor,r[i].m_price,r[i].m_use);}}printf("\n 请你输入要预订的房间号:");scanf("%d",&num);reg = 0;for(i=0;i<count;i++){if(r[i].m_use==1&&r[i].m_num==num){r[i].m_use = 0;printf("\n 预订成功!\n");cus[j].num=r[i].m_num ;j=j+1;reg=1;}}if(reg==0){printf("\n 预订失败!\n");}}void UnCustomer_Out(){int k;printf("\n 请输入要退房顾客身份证:");scanf("%s",&ID);for(i=0;i<count;i++){if(strcmp(cus[i].m_ID,ID)==0){printf("\n\r顾客身份证号:%s 姓名:%s 年龄:%d 性别:%s \n\r已经成功退房!",cus[i].m_ID,cus[i].m_name,cus[i].m_age,cus[i].m_sex);for(k=0;k<count;k++)if(r[k].m_num==cus[i].num)r[k].m_use=1;memset(&cus[i],0,sizeof(Customer));}}}void Customer_Goaway(){fproom=fopen("room","wb+");fwrite((void *)&r,sizeof(Room),count,fproom);fclose(fproom);fpcustomer=fopen("customer","wb+");fwrite((void*)&r,sizeof(Room),count,fpcustomer);fclose(fpcustomer);exit(0);}main(){fproom=fopen("room","wb");if(fproom!=NULL){for(i=0;i<count;i++){int id=100;r[i].m_num=i+100;r[i].m_floor=1;r[i].m_price=100;r[i].m_use=1;}fwrite((void *)&r,sizeof(Room),count,fproom);fclose(fproom);}else{printf("\n---文件打开失败--");}for(;;){printf("\n");printf("/******************************************\\\n ");printf("**\n");printf("* 酒店管理系统*\n");printf("* 主菜单*\n");printf("**\n");printf("* 1.顾客登记*\n");printf("* 2.查询顾客信息*\n");printf("* 3.查询空房间*\n");printf("* 4.预订房间*\n");printf("* 5.退订房间*\n");printf("* 6.保存并退出系统*\n");printf("**\n");printf("\\******************************************/\n\ n");printf("请输入选择项(1-6):");scanf("%d",&n);printf("\n\n\n\n");if(n>0&&n<=6){switch(n){case 1:Customer_Input();break;case 2:Customer_ListOut();break;/*查询顾客信息*/case 3:Room_ListOut();break;/*查询空房间*/case 4:PerCustomer_Search();break;/*预订房间*/case 5:UnCustomer_Out();break;/*退订房间*/case 6:Customer_Goaway(); /*保存退出*/}}else{printf("********************************************* **************************\n");printf("**\n");printf("*输入错误! *\n");printf("*请退出! *\n");printf("**\n");printf("********************************************* **************************\n");break;}} }。
酒店管理系统c语言程序设计

酒店管理系统c语言程序设计以下是一个简单的酒店管理系统的 C 语言程序设计示例,包括了客户入住、退房和查询房间状态等基本功能。
请注意,这只是一个简化的示例,实际的酒店管理系统可能需要更多的功能和复杂的逻辑。
```c#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAX_ROOMS 100#define MAX_CUSTOMERS 100// 房间结构体struct Room {int roomNumber;int isOccupied;int customerID;};// 客户结构体struct Customer {int customerID;char customerName[50];};// 房间列表struct Room rooms[MAX_ROOMS];// 客户列表struct Customer customers[MAX_CUSTOMERS];// 初始化房间列表void initRooms() {for (int i = 0; i < MAX_ROOMS; i++) {rooms[i].roomNumber = i + 1;rooms[i].isOccupied = 0;rooms[i].customerID = 0;}}// 初始化客户列表void initCustomers() {for (int i = 0; i < MAX_CUSTOMERS; i++) {customers[i].customerID = i + 1;strcpy(customers[i].customerName, "Customer");}}// 查找空闲房间int findFreeRoom() {for (int i = 0; i < MAX_ROOMS; i++) {if (rooms[i].isOccupied == 0) {return i;}}return -1;}// 客户入住void checkIn(int customerID, int roomNumber) {int freeRoom = findFreeRoom();if (freeRoom != -1) {rooms[freeRoom].isOccupied = 1;rooms[freeRoom].customerID = customerID;printf("Customer %d checked in to Room %d\n", customerID, roomNumber); } else {printf("No free rooms available\n");}}// 客户退房void checkOut(int roomNumber) {for (int i = 0; i < MAX_ROOMS; i++) {if (rooms[i].roomNumber == roomNumber && rooms[i].isOccupied == 1) { rooms[i].isOccupied = 0;rooms[i].customerID = 0;printf("Customer checked out of Room %d\n", roomNumber);return;}}printf("Room not found\n");}// 查询房间状态void viewRoomStatus(int roomNumber) {for (int i = 0; i < MAX_ROOMS; i++) {if (rooms[i].roomNumber == roomNumber) {if (rooms[i].isOccupied == 1) {printf("Room %d is occupied by Customer %d\n", roomNumber, rooms[i].customerID);} else {printf("Room %d is vacant\n", roomNumber);}return;}}printf("Room not found\n");}// 主函数int main() {initRooms();initCustomers();int choice;while (1) {printf("1. Check In\n2. Check Out\n3. View Room Status\n4. Exit\n"); scanf("%d", &choice);switch (choice) {case 1:int customerID, roomNumber;printf("Enter customer ID: ");scanf("%d", &customerID);printf("Enter room number: ");scanf("%d", &roomNumber);checkIn(customerID, roomNumber);break;case 2:printf("Enter room number: ");scanf("%d", &roomNumber);checkOut(roomNumber);break;case 3:printf("Enter room number: ");scanf("%d", &roomNumber);viewRoomStatus(roomNumber);break;case 4:exit(0);break;default:printf("Invalid choice\n");}}return 0;}```上述代码实现了一个简单的酒店管理系统,包括客户入住、退房和查询房间状态等功能。
(完整版)C语言酒店管理系统

for(y=0;y<5;y++)
{
if(room[x][y]==0)
{
printf("空%d-%d |",x+1,y+1);
}else
{
printf("住%d-%d |",x+1,y+1);
}
if(y+1==5)
{
if(x+1==1||x+1==2)
printf("该层标间均50元");
else
printf("该层标间均100元");
printf("\t2.查询房间的入住情况\n");
printf("\t3.查询当前费用\n");
printf("\t4.结账退房\n");
printf("\t5.退出程序\n");
}
void hotel_execute();
void hotel_select();
void hotel_outhotel();
{
printf("|-------|--------|--------|--------|--------|--------|\n|第%d层|",x+|-------|--------|--------|--------|--------|--------|\n|第%d层|",x+1);
}
}
}
printf("\n|-------|--------|--------|--------|--------|--------|\n");
酒店管理系统C语言版

#i n c l u d e<s t d i o.h>#include<stdlib.h>struct peopledata{char name[11];char sex[3];int age;int idcard[2];};struct datefflush(stdin);printf("房间类型:");scanf("%c",&room.kind);printf("住宿人员信息:\n");printf("\t\t姓名:");fflush(stdin);scanf("%s",);fflush(stdin);printf("\t\t性别:");gets(room.people.sex);printf("\t\t年龄:");scanf("%d",&room.people.age);printf("\t\t请输入身份证号码:");for(i=0;i<2;i++)scanf("%d",&room.people.idcard[i]); printf("入住时间:\n");printf("\t\t年:");scanf("%d",&room.time.year);printf("\t\t月:");scanf("%d",&room.time.month);printf("\t\t日:");scanf("%c",&tag);fflush(stdin);}else{printf("要继续添加吗?(y/n)\n");scanf("%c",&tag);fflush(stdin);}}fclose(fp);} while(tag=='y');}void updata(){FILE *fp;rooms room;int number,i;printf("请输入要更新的信息的房间编号:\n");scanf("%d",&number);printf("\t\t姓名\t性别\t年龄");printf("\t\t%s\t%s\t%d\n",,room.people.sex,room.people.age);printf("身份证号:");for(i=0;i<2;i++)printf("%d",room.people.idcard[i]);putchar('\n');printf("入住时间:\n");printf("%d年%d月%d日\n",room.time.year,room.time.month,room.time.day);printf("入住时长:\n");printf("%d天\n",room.time.time);printf("\t————————————————\n");printf("*******************************************************\n");printf("请输入更新信息:\n");printf("房间编号:");scanf("%d",&room.number);fflush(stdin);printf("房间类型:");scanf("%c",&room.kind);printf("住宿人员信息:\n");printf("\t\t姓名:");fflush(stdin);void searchdata(){FILE *fp;rooms room;int number,i;printf("请输入要查询的信息的房间编号:\n");scanf("%d",&number);if((fp=fopen("d:\\酒店住宿登记表.txt","r+"))==NULL){printf("打开文件”酒店住宿登记表“失败,按任意键退出。
酒店管理系统代码

附录Base.Dlg.cpp程序:#include "stdafx.h"#include "MyPos.h"#include "BaseDlg.h"#include "MaterielDlg.h"#include "ClassDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CBaseDlg dialogCBaseDlg::CBaseDlg(CWnd* pParent /*=NULL*/): CDialog(CBaseDlg::IDD, pParent){//{{AFX_DATA_INIT(CBaseDlg)// NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT}void CBaseDlg::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CBaseDlg)DDX_Control(pDX, IDC_TAB_BASE, m_oTabBase);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CBaseDlg, CDialog)//{{AFX_MSG_MAP(CBaseDlg)//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CBaseDlg message handlersBOOL CBaseDlg::OnInitDialog(){CDialog::OnInitDialog();// TODO: Add extra initialization herem_oTabBase.AddPage("商品类别", &m_oClassdlg, IDD_DIALOG_CLASS);m_oTabBase.AddPage("商品资料", &m_oMaterieldlg, IDD_DIALOG_MA TERIEL);m_oTabBase.AddPage("付款方式", &m_oPaymodedlg, IDD_DIALOG_PAYMODE);m_oTabBase.Show();return TRUE; // return TRUE unless you set the focus to a control// EXCEPTION: OCX Property Pages should return FALSE}CallDlg.cpp程序:#include "stdafx.h"#include "MyPos.h"#include "CallDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CCallDlg dialogextern CMyPosApp theApp;CCallDlg::CCallDlg(CWnd* pParent /*=NULL*/): CDialog(CCallDlg::IDD, pParent){//{{AFX_DATA_INIT(CCallDlg)// NOTE: the ClassWizard will add member initialization here//}}AFX_DATA_INIT}void CCallDlg::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CCallDlg)DDX_Control(pDX, IDC_STATIC_CALL, m_oCallstatic);DDX_Control(pDX, IDC_EDIT_CALLBILLID, m_oCallbillid);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CCallDlg, CDialog)//{{AFX_MSG_MAP(CCallDlg)//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CCallDlg message handlersvoid CCallDlg::OnOK(){if(dowhat=="imhappy"){theApp.scallid="";m_oCallbillid.GetWindowText(theApp.scallid);}if(dowhat=="pleased")m_oCallbillid.GetWindowText(dowhat);CDialog::OnOK();}BOOL CCallDlg::OnInitDialog(){CDialog::OnInitDialog();if(dowhat=="pleased")m_oCallstatic.SetWindowText("请输入桌号:");return TRUE; // return TRUE unless you set the focus to a control// EXCEPTION: OCX Property Pages should return FALSE }CheckDlg.cpp程序:#include "stdafx.h"#include "MyPos.h"#include "CheckDlg.h"#include "PosDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CCheckDlg dialogextern CMyPosApp theApp;CCheckDlg::CCheckDlg(CWnd* pParent /*=NULL*/): CDialog(CCheckDlg::IDD, pParent){//{{AFX_DATA_INIT(CCheckDlg)//}}AFX_DATA_INIT}void CCheckDlg::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CCheckDlg)DDX_Control(pDX, IDC_EDIT_CONSUME, m_oConsume);DDX_Control(pDX, IDC_EDIT_CDISCOUNT, m_oCdiscount);DDX_Control(pDX, IDC_EDIT_RECEIVE, m_oReceive);DDX_Control(pDX, IDC_EDIT_CHANGE, m_oChange);DDX_Control(pDX, IDC_EDIT_TOTALM, m_oTotalm);DDX_Control(pDX, IDC_COMBO_PAYMODE, m_oCombopay);DDX_Control(pDX, IDC_LIST_CHECKLIST, m_oChecklist);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CCheckDlg, CDialog)//{{AFX_MSG_MAP(CCheckDlg)ON_BN_CLICKED(IDC_BUTTON_CHECKOK, OnButtonCheckok)ON_EN_CHANGE(IDC_EDIT_RECEIVE, OnChangeEditReceive)ON_NOTIFY(NM_CLICK, IDC_LIST_CHECKLIST, OnClickListChecklist) ON_EN_CHANGE(IDC_EDIT_CDISCOUNT, OnChangeEditCdiscount)ON_BN_CLICKED(IDC_BUTTON_RF, OnButtonRf)ON_BN_CLICKED(IDC_BUTTON_HANG, OnButtonHang)//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CCheckDlg message handlersBOOL CCheckDlg::OnInitDialog(){CDialog::OnInitDialog();//设置list控件的文字和背景颜色m_oChecklist.SetBkColor(RGB(255,255,255));m_oChecklist.SetTextBkColor(RGB(161,223,212));//清空list控件的数据for(int delcolumn=100;delcolumn>=0;delcolumn--)m_oChecklist.DeleteColumn(delcolumn);//设置list对话框的列DWORD dwStyle;RECT rect;LV_COLUMN lvc;dwStyle = m_oChecklist.GetStyle();dwStyle |= LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT|LVS_SHOWSELALWAYS ;m_oChecklist.SetExtendedStyle(dwStyle);m_oChecklist.GetClientRect(&rect);lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH |LVCF_FMT;lvc.fmt=LVCFMT_LEFT;lvc.iSubItem = 0;lvc.pszText = _T("商品类别");lvc.cx = 110;m_oChecklist.InsertColumn(1,&lvc);lvc.iSubItem = 1;lvc.pszText = _T("消费金额");lvc.cx = 90;m_oChecklist.InsertColumn(2,&lvc);lvc.iSubItem = 2;lvc.pszText = _T("可折扣金额");lvc.cx = 90;m_oChecklist.InsertColumn(3,&lvc);lvc.iSubItem = 3;lvc.pszText = _T("折扣%");lvc.cx = 60;m_oChecklist.InsertColumn(4,&lvc);lvc.iSubItem = 4;lvc.pszText = _T("结帐金额");lvc.cx = 90;m_oChecklist.InsertColumn(5,&lvc);//Add paymode to combobox._RecordsetPtr m_pRecordset;CString sql="select * from PAYMODE";try{m_pRecordset.CreateInstance("ADODB.Recordset");m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),a dOpenStatic,adLockOptimistic,adCmdText);while(!m_pRecordset->adoEOF){m_oCombopay.AddString((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("NAME"));m_pRecordset->MoveNext();}m_pRecordset->Close();m_oCombopay.SetCurSel(0);//Select the 1st string of combobox.}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]读取付款方式到组合框出错:%s",e.ErrorMessage());AfxMessageBox(temp);}//Read class consume to list.ReadtoList(theApp.scallid);//Sum bill Items money from database.CString stotal;float ftotal=0;sql="Select SUM(ITEMTOTAL) as SSS from SALEDETAIL where BILLID='"+theApp.scallid+"'";try{m_pRecordset.CreateInstance("ADODB.Recordset");m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),a dOpenStatic,adLockOptimistic,adCmdText);_variant_t vtemp = m_pRecordset->GetCollect("SSS");if(vtemp.dblVal>0)ftotal=(float)m_pRecordset->GetCollect("SSS");elseftotal=0;stotal.Format("%.2f",ftotal);m_oTotalm.SetWindowText(stotal);m_oConsume.SetWindowText(stotal);}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]计算单据商品金额出错:%s",e.ErrorMessage());AfxMessageBox(temp);}return TRUE; // return TRUE unless you set the focus to a control// EXCEPTION: OCX Property Pages should return FALSE}void CCheckDlg::OnButtonCheckok(){CString stotal,sbilltotal,spayID,sql,spaymode,snowtime;long lpayID;_RecordsetPtr m_pRecordset;m_oConsume.GetWindowText(stotal);m_oTotalm.GetWindowText(sbilltotal);int nselect=m_oCombopay.GetCurSel();m_oCombopay.GetLBText(nselect,spaymode);lpayID=GetPaymodeID(spaymode);spayID.Format("%d",lpayID);if(fchange<0)return;//得到系统时间CTime now=CTime::GetCurrentTime();snowtime=now.Format(_T("%Y-%m-%d %H:%M:%S"));sql="Update SALEBILL set ENDDATE='"+snowtime+"',SALES='"++"',TOTAL="+stotal+",ACTTOTAL="+sbilltotal+",STATUS='已结帐',PAYMODE="+spayID+" where ID='"+theApp.scallid+"'";try{_variant_t RecordsAffected;theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]单据头更新数据库出错:%s",e.ErrorMessage());AfxMessageBox(temp);return;}//output the checkout time and paymode to the print.theApp.snowtimep=snowtime;theApp.spaymodep=spaymode;theApp.sconsume=stotal;theApp.sactsum=sbilltotal;//Insert data into PAYDETAIL.CString sclass,scontotal,sdiscount,sacttotal,svaltotal;int nItemCount=m_oChecklist.GetItemCount();//表项总数for(int i=0;i<nItemCount;i++){sclass=m_oChecklist.GetItemText(i,0);scontotal=m_oChecklist.GetItemText(i,1);sdiscount=m_oChecklist.GetItemText(i,3);sacttotal=m_oChecklist.GetItemText(i,4);float fvaltotal=atof(scontotal)-atof(sacttotal);svaltotal.Format("%.2f",fvaltotal);sql="Insert into PAYDETAIL(BILLID,CLASS,TOTAL,DISCOUNT,ACTTOTAL,VALTOTAL)values('"+theApp.scallid+"','"+sclass+"',"+scontotal+",'"+sdiscount+"',"+sacttotal+","+svaltotal+")";try{_variant_t RecordsAffected;theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]付款明细(PAYDETAIL)插入数据出错:%s",e.ErrorMessage());AfxMessageBox(temp);return;}}//When the check button is click down,send a message(WM_CHECKOUT) to the CPosDlg.LRESULT Res=::SendMessage(theApp.pWnd, WM_CHECKOUT, 0, 0);CDialog::OnOK();}long CCheckDlg::GetPaymodeID(CString payname){long paymodeID;_RecordsetPtr m_pRecordset;CString sql="Select * from PAYMODE where NAME='"+payname+"'";try{m_pRecordset.CreateInstance("ADODB.Recordset");m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),a dOpenStatic,adLockOptimistic,adCmdText);paymodeID=(long)m_pRecordset->GetCollect("ID");}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]获取付款方式ID出错:%s",e.ErrorMessage());AfxMessageBox(temp);}return paymodeID;}void CCheckDlg::OnChangeEditReceive(){// TODO: If this is a RICHEDIT control, the control will not// send this notification unless you override the CDialog::OnInitDialog()// function and call CRichEditCtrl().SetEventMask()// with the ENM_CHANGE flag ORed into the mask.CString sreceive,schange,stotal;m_oChange.SetWindowText("");m_oReceive.GetWindowText(sreceive);m_oTotalm.GetWindowText(stotal);fchange=atof(sreceive)-atof(stotal);if(fchange>=0){schange.Format("%.2f",fchange);m_oChange.SetWindowText(schange);}}void CCheckDlg::ReadtoList(CString sbillid){_RecordsetPtr m_pRecordset; //Must define it in functionCString sql,sclassname,sclassname1,sctotal;long lclassid;float fctotal=0;sql="Select Sum(ITEMTOTAL) as XXX,CLASSID from SALEDETAIL where BILLID='"+sbillid+"' group by CLASSID ";//删除所有list中的数据。
C语言宾馆管理系统源代码

else
{
printf("要删除的话就按1:");
scanf("%d",&i);
if(i==1)
{
q=head;
while(q!=NULL&&q->next!=p)
q=q->next;
q->next=p->next;
}
while(b--)
{
p=(listnode *)malloc(sizeof(listnode));
printf("姓名 性别 证件 入住 天数 房号 标准 价格 预收 押金 离开 备注\n");
printf("**********************************************************************\n");
printf("*******************************************\n");
printf("姓名查找,按1表示查找:");
p=head->next;
scanf("%d",&i);
if(i==1)
{
printf("请输入要查询的姓名:");
scanf("%s",&come);
while(p&&strcmp(p->e,come)<0)
p=p->next;
if(p==NULL||strcmp(p->e,come)>0)
C语言课程设计---酒店房间登记与计费管理系统源代码

酒店房间登记与计费管理系统源代码#define M 80#include<>#include<>#include<>/*函数声明*/void check_in(); /*登记入住函数*/。
void chamber(); /*入住情况函数*/void price(); /*当前费用函数*/void fee(); /*结账退房函数*/void infor(); /*信息查询函数*/void save(int); /*保存信息函数*/void read(int); /*读取信息函数*/void choice(); /*功能选择函数*/int judge_year(int); /*判断闰年函数*/|void information(); /*输出全部房间信息*//*结构体*/struct time{int year;int mon;int date;int hour;"};struct room /*定义各房间信息的结构体*/{char name[40];char ID[18];int flag; /* 0-无人入住,1-按小时计费,2-按天计费*/ long int deposit;time t[2]; /* 0-入住时间,1-当前时间*/》}room[M];char c1[40]={0};char c2[18]={0};/*主函数(主界面)*/void main(){system("cls"); /*清屏*/system("color 4E");、int n;printf("********************************************************** **********************");printf("****");printf("**\t\t ---------- 欢迎光临万豪酒店---------- **");printf("****");printf("********************************************************** **********************\n\n");printf("\t\t\t [ 1. 登记入住]\n\n");printf("\t\t\t [ 2. 入住情况]\n\n");—printf("\t\t\t [ 3. 当前费用]\n\n");printf("\t\t\t [ 4. 结账退房]\n\n");printf("\t\t\t [ 5. 信息查询]\n\n");printf("\t\t\t [ 6. 全部信息]\n\n");printf("\t\t\t [ 7. 退出系统]\n\n");printf("请输入您需要的服务的代码:");scanf("%d",&n);while(n<1||n>7);{printf("\n\n代码输入有误,请您重新输入:");scanf("%d",&n);}switch(n) /*根据输入数字选择功能*/ {case 1:check_in();break; /*调用登记入住函数*/case 2:chamber();break; /*调用房间情况函数*/case 3:price();break; /*调用当前费用函数*/case 4:fee();break; /*调用结账退房函数*/·case 5:infor();break; /*调用信息查询函数*/case 6:information();break; /*调用全部信息函数*/case 7:exit(0); /*调用退出系统函数*/}}/*查看房间使用情况函数*/void chamber()·{system("cls"); /*清屏*/system("color 4E");printf("\n**********************************房间使用情况**********************************\n");int count=0;int i;int j;int k;int m;—for(i=1;i<=80;i++) /*统计未入住房间总数*/{read(i);if(room[i-1].flag==0)count++;}printf("当前未使用房间数:%d\n\n\n",count);chaxun:printf("请输入你要查询的房间号(1-40:单人间,41-80:双人间):");/*输入房间号查询房间入住情况*/~scanf("%d",&m);while(m<1||m>80){printf("\n\n房间号输入有误,请您重新输入:");scanf("%d",&m);}read(m);while(room[m-1].flag!=0){printf("\n\n对不起,该房间已有客人入住,请输入其他房间号:");|scanf("%d",&m);read(m);}printf("\n\n该房间没有客人入住,您要入住该房间吗(1-是,2-否):"); scanf("%d",&j);while(j<1||j>2){printf("\n\n您的选择输入有误,请您重新输入:");scanf("%d",&j);}^if(j==1)check_in();else{printf("\n\n您需要继续查询吗(1-是,2-否):");scanf("%d",&k);while(k<1||k>2){printf("\n\n您的选择输入有误,请您重新输入:");scanf("%d",&k);)}if(k==1)goto chaxun;else{printf("\n\n");main();}}}/*登记入住函数*/void check_in(){system("cls"); /*清屏*/system("color 4E");int i;int j;int l;:int k;int tab[2][12]={{31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31}};printf("\n************************************登记入住************************************\n");printf("请输入您将入住的房间号:");scanf("%d",&i);while(i<1||i>80){printf("\n\n房间号输入有误,请您重新输入:");%scanf("%d",&i);}read(i);while(room[i-1].flag!=0) /*判断房间是否入住*/ {printf("\n\n对不起,该房间已有客人入住,请输入其他房间号:"); scanf("%d",&i);read(i);}printf("\n\n请输入您的姓名:"); /*客人信息登记*/|scanf("%s",room[i-1].name);j=strlen(room[i-1].name);while(j<0){printf("\n\n您的姓名输入有误,请您重新输入:\n");scanf("%s",room[i-1].name);j=strlen(room[i-1].name);}printf("\n\n请输入您的证件号码:");。
酒店管理系统c语言

酒店管理系统1. 引言酒店管理系统是一种用于管理酒店日常运营的软件系统。
它可以帮助酒店管理人员提高工作效率,提供优质的服务,实现酒店的可持续发展。
本文将介绍一个基于C 语言开发的酒店管理系统,包括系统的功能设计、数据库设计、用户界面设计以及系统测试等内容。
2. 功能设计2.1 客房管理客房管理是酒店管理系统最重要的功能之一。
在该功能下,可以实现以下操作:•客房信息录入:输入客房号码、类型、价格等信息。
•客房信息查询:根据客房号码或类型查询客房信息。
•客房信息修改:修改客房的价格、状态等信息。
•客房状态查询:查询客房的入住状态。
2.2 预订管理预订管理是指对客户预订酒店客房的操作。
在该功能下,可以实现以下操作:•房间预订:根据客户需求,预订适合的客房。
•预订查询:查询已预订的客房信息。
•预订取消:取消已预订的客房。
2.3 入住管理入住管理是指客户入住酒店的操作。
在该功能下,可以实现以下操作:•入住登记:输入客户信息,将客户分配到合适的客房。
•入住查询:查询已入住客房的信息。
•退房办理:将已入住客房标记为可用状态。
2.4 结算管理结算管理是指对客户住宿费用进行结算的操作。
在该功能下,可以实现以下操作:•账单生成:根据客户入住情况,生成相应的账单。
•账单查询:查询客户的消费情况。
•结算处理:对客户账单进行结算。
3. 数据库设计酒店管理系统需要使用数据库来存储和管理数据。
以下是数据库设计的关键表格:3.1 客房信息表字段名类型描述RoomID int 客房号码RoomType varchar 客房类型Price float 客房价格Status int 客房状态CreateTime date 创建时间3.2 预订信息表字段名类型描述ReservationID int 预订号码CustomerID int 客户号码RoomID int 客房号码CheckInDate date 入住日期CheckOutDate date 退房日期3.3 入住信息表字段名类型描述CheckInID int 入住号码CustomerID int 客户号码RoomID int 客房号码CheckInDate date 入住日期3.4 账单信息表字段名类型描述BillID int 账单号码CustomerID int 客户号码RoomID int 客房号码TotalAmount float 总金额4. 用户界面设计用户界面是酒店管理系统与用户进行交互的重要环节。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
}
}
printf("没有找到该旅客的信息!");
}
else if(index == 3)
{
printf("请输入你要查询的房间号:");
scanf("%d",&number);
j = number - 301;
if(roomArray[j].Count == 0)
{
printf("没有客人入住\n");
{
memset(roomArray[i].nameOne,0,20);
roomArray[i].sexOne = 0;
roomArray[i].Count--;
system("cls");
printf("%s客人已经成功退房\n",name);
return;
}
if(strcmp(roomArray[i].nameTwo,name) == 0)
printf(" 4.退出 exit\n");
printf("请输入你要选择的操作: ");
}
int main()
{
int i= 100;
InitArray();
printf("*******************宾馆信息管理软件*******************\n");
while(i != 4)
{
memset(roomArray[i].nameTwo,0,20);
roomArray[i].sexTwo = 0;
roomArray[i].Count--;
system("cls");
printf("%s客人已经成功退房\n",name);
return;
}
}
system("cls");
printf("没有名为%s的客人,请检查输入的正确性!\n",name);
memset(roomArray[i].nameOne,0,20);
memset(roomArray[i].nameTwo,0,20);
roomArray[i].sexOne = 0;
roomArray[i].sexTwo = 0;
roomArray[i].Count = 0;
}
}
void fun1() //旅客入住的操作
{
printf("\n");
show();
scanf("%d",&i);
switch(i)
{
case 1:
fun1();
break;
case 2:
fun2();
break;
case 3:
fun3();
break;
}
}
system("pause");
return 0;
}
printf(" 2.按照姓名查询\n");
printf(" 3.按照房号查询\n");
scanf("%d",&index);
if(index == 1)
{
for( i=0;i<5;i++)
{
printf("房间%d:",roomArray[i].roomNumber);
if(roomArray[i].Count == 0)
if(roomArray[i].sexTwo == 1)
printf("性别:男,");
else if(roomArray[i].sexOne == -1)
printf("性别:女,");
printf("\n");
}
}
}
else if(index == 2)
{
printf("请输入你要查询房客的姓名:");
scanf("%s",name);
for(i=0;i<5;i++)
{
if(strcmp(roomArray[i].nameOne,name) == 0 || strcmp(roomArray[i].nameTwo,name) == 0)
{
printf("%s房客入住在房间%d!\n",name,roomArray[i].roomNumber);
}
}
}
void show()
{
system("color 9f");
printf("*******************请选择操作************************\n");
printf(" 1.旅客入住\n");
printf(" 2.旅客退房\n");
printf(" 3.信息查询\n");
return;;
}
}
printf("无法入住,房间已经住满或者是没有适合的房间");
}
void fun2() //退房操作
{
int i;
char name[20];
printf("请输入要退房旅客的姓名: ");
scanf("%s",name);
for(i=0;i<5;i++)
{
if(strcmp(roomArray[i].nameOne,name) == 0)
if(roomArray[i].sexTwo == 1)
printf("性别:男");
else if(roomArray[i].sexTwo == -1)
printf("性别:女");
printf("\n");
}
}
else
{
//printf("当前有两个客人 客人1: 姓名%s,性别%d 客人2: 姓名%s,性别%d \n",roomArray[i].nameOne,roomArray[i].sexOne,roomArray[i].nameTwo,roomArray[i].sexTwo);
printf("当前有2位客人-> 姓名%s,",roomArray[i].nameOne);
if(roomArray[i].sexOne == 1)
printf("性别:男,");
else if(roomArray[i].sexOne == -1)
printf("性别:女,");
printf("姓名:%s,",roomArray[i].nameTwo);
int sexOne; //房客1的性别 -1代表女,0代表没有,1代表男
int sexTwo; //房客2的性别
int roomNumber; //房间号
}roomArray[5];
//初始化房间数组
void InitArray()
{
int i;
for(i=0;i<5;i++)
{
roomArray[i].roomNumber = 301+i;
}
else if(roomArray[j].Count == 1)
{
printf("当前有1位客人-> 姓名%s,性别%d!",roomArray[j].nameOne,roomArray[j].sexOne);
}
else
{
printf("当前有两个客人入住 姓名%s,性别%d 姓名%s,性别%d \n",roomArray[j].nameOne,roomArray[j].sexOne,roomArray[j].nameTwo,roomArray[j].sexTwo);
printf("性别:男");
else if(roomArray[i].sexOne == -1)
printf("性别:女");
printf("\n");
}
else if(roomArray[i].sexOne == 0)
{
printf("当前有1位客人-> 姓名%s,",roomArray[i].nameTwo);
{
if(roomArray[i].sexOne != sex)
{
continue;
}
strcpy(roomArray[i].nameTwo,name);
roomArray[i].sexTwo = sex;
roomArray[i].Count++;
system("cls");
printf("客人已经成功入住,在房间%d",roomArray[i].roomNumber);
}
void fun3() //查询操作
{int index; Nhomakorabeaint i;
char name[20];
int number;
int j;
system("cls");
printf("***************请选择要查询的种类***************\n");
printf(" 1.所有房间入住信息显示\n");
#include <stdio.h>