当前位置:网站首页>C language course design -- hotel management system
C language course design -- hotel management system
2022-07-24 12:35:00 【Suyao Muzi】
Course design topic : Hotel Management System
One 、 Demand analysis
In recent years , Scientific and technological progress has not only promoted the rapid growth of global tourism enterprises , It also guides tourists' consumption concept to update , Among them, the development of information and communication technology has a far-reaching impact on hotels and other enterprises , The traditional way of management is no longer It can meet the requirements of having a large amount of information , A lot of queries , Long shelf life , Requirements for hotel management with uninterrupted operation and other characteristics , Attaching importance to the development of information technology has become the consensus of China's hotel industry . To enhance competitiveness , Improve the management level , advanced Hotel management system has become inevitable . Hotel management system can timely understand customer information and needs , Realize Hotel Management Promotion of information technology , The implementation of hotel management system can gradually improve the modernization of hotels , Improve employee productivity , A good management system increasingly establishes a good image of the service department , It is conducive to business standardization , Standardization , advantageous to Improve the management level , It is conducive to creating higher economic and social benefits , Modernize the management process .
Two 、 overall design 
3、 ... and 、 Detailed design
This system mainly realizes the establishment of customer information , lookup , Delete and other functions . The main menu of the system is generated by the main function ,
Provide access to various interfaces . Mainly for SWITCH Switch statements enter different interfaces , Input “1” Entry guest
Library information establishment interface , Input “2” Enter the information adding interface , Input “3” Enter the customer name query interface , transport
Enter into “4” Enter the customer gender query interface , Input “5” Enter the room number query interface . Input “6” When entering the check-in
Inter query interface , Input “7” Enter the customer information modification interface , Input “8” Enter the customer information deletion interface , transport
Enter into “9” Enter the customer information deletion interface , Input “0” Exit the system . Procedure by C Language combined with data structure
Set up a linear linked list of knowledge programming
Four 、 Debugging and testing
5、 ... and 、 User's Manual
1. Enter... In the main menu “1” Get into “ Hotel information establishment interface ”. This interface can establish
Basic information of customers : full name , Gender , Id no. , Check in time , Days , room number , Pledge
gold , Departure time, etc , And return to the main menu .
2. Hotel information add function
Enter... In the main menu “2” Get into “ Hotel information adding interface ”. This interface can add
Number of customers and basic information of customers : full name , Gender , Id no. , Check in time , Days ,
room number , The deposit , Departure time, etc , And return to the menu for the next step .
3. Customer name inquiry function
Enter... In the main menu “3” Get into “ Customer name query interface ”. In this interface, first root
Enter 1 Means to search by name , Then enter the customer name and confirm to query the customer
The basic information of the user is displayed . This function can easily query customers with a certain name
Room information .
4. Customer gender inquiry function
Enter... In the main menu “4”, Get into “ Customer gender query interface ”. In this interface, you can press customer
The gender of the customer queries the basic information of all customers of a certain gender , This function can query the same
Gender guest information , And compare different passenger flows , Plan to increase passenger flow .
5. Hotel room number inquiry function
Enter... In the main menu “5”, Get into “ Hotel room number query interface ”. In this interface, you can press already
Know the room number to query the basic information of customers , This function can determine the occupancy of a room ,
If there is no one, there is no room information , If someone lives in, it can be based on the previously established or added
The customer information shows the registration information of the guests living in the room .
6. Check in time query function
Enter... In the main menu “6”, Get into “ Check in time query interface ”. In this interface, you can
Check the basic information of customer registration through the approximate check-in time , This function can be queried in the same
Guests who stay in the hotel for a day
7. Customer information modification function
Enter... In the main menu “7”, Get into “ Customer information modification interface ”. In this interface, first
Find the customer information through the previous customer name , Then according to the customer name to be modified ,
Modify customer information . This function is convenient for customers who need to increase their accommodation time
guard .
8. Customer information deletion function
Enter... In the main menu “8”, Get into “ Customer information deletion interface ”. In this interface
You can delete the basic information of the customer by the customer's name , Use del() function , Enter the customer
full name , OK to delete, press 1, This function can be saved for a long time, and now it does not need to be preserved
Delete the information of the customer .
9. Customer information display function
Enter... In the main menu “9”, Get into “ Customer information display interface ”. In this interface
The basic information of customers can be queried according to their gender , This function can display all customer information
Displayed on the output interface , Staff can observe directly .
6、 ... and . Source code
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
typedef struct
{
char name[50];
char sex[50];
char ID[50];
char come[50];
char day[50];
char number[50];
char type[50];
char price[50];
char yushou[50];
char yajin[50];
char leave[50];
}datatype;
typedef struct node
{
datatype data;
struct node *next;
}listnode;
typedef listnode *linklist;
linklist head;
listnode *p;
void Output_allInfo(linklist head);// Output all customer information
void Delete_info(linklist head);// Deletion of customer information
void Info_Modify(linklist head);// Modify according to the information of the customer's name
listnode *Name_Search(linklist head); // Find hotel information by name
listnode *Sex_Search(linklist head);// Find hotel information by gender
listnode *Roomnum_Search(linklist head);// Find hotel information by room number
listnode *Cometime_Search(linklist head) ;// Find by check-in time
char Display_Menu();// Menu output function
listnode* Add(linklist head,int b);// Add customer information
linklist Create(int a);// Establishment of hotel customer information
void SaveInfoToFile(linklist head);// Save customer information to file
listnode *ReadInfoFromFile();// Information is read from the file
int main()// The main function
{
int i,a;
for(;;)
{
switch(Display_Menu())
{
case 1: printf("**2. Establishment of hotel information **\n");
printf(" Enter the number you want to enter :");
scanf("%d",&i); head=Create(i); break;
case 2: printf("**1. Read the customer information from the file !**\n");
ReadInfoFromFile(); break;
case 3: printf("**3. Add hotel information **\n");
printf(" Enter the number of people you want to add :");
scanf("%d",&a);
Add(head,a); break;
case 4: printf("**4. Inquiry of customer name **\n");
p=Name_Search(head); if(p!=NULL)
{
printf(" full name \t Gender \t certificates \t To stay in \t Days \t room number \t Price \t The deposit \t Leave \n ");
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",p->data.name,p->data.sex,p->data.ID,
p->data.come,p->data.day,p->data.number,p->data.price,p->data.yajin,p->data.leave );
printf("\n");
}
else printf(" The user does not exist !");break;
case 5: printf("**5. Inquiry of customer gender **\n");
p=Sex_Search(head);
if(p!=NULL)
{
printf(" full name \t Gender \t certificates \t To stay in \t Days \t room number \t Price \t The deposit \t Leave \n ");
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",p->data.name,p->data.sex,p->data.ID,
p->data.come,p->data.day,p->data.number,p->data.price,p->data.yajin,p->data.leave );
printf("\n");
}
else
printf(" The user does not exist !");break;
case 6:
printf("**6. Inquiry of customer's room number **\n");
p=Roomnum_Search(head);
if(p!=NULL)
{
printf(" full name \t Gender \t certificates \t To stay in \t Days \t room number \t Price \t The deposit \t Leave \n ");
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",p->data.name,p->data.sex,p->data.ID,
p->data.come,p->data.day,p->data.number,p->data.price,p->data.yajin,p->data.leave );
printf("\n");
}
else printf(" The room information does not exist !");break;
case 7:
printf("**7. Inquiry of customer gender **\n");
p=Cometime_Search(head);
if(p!=NULL)
{
printf(" full name \t Gender \t certificates \t To stay in \t Days \t room number \t Price \t The deposit \t Leave \n ");
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",p->data.name,p->data.sex,p->data.ID,
p->data.come,p->data.day,p->data.number,p->data.price,p->data.yajin,p->data.leave );
printf("\n");
}
else printf(" The room information does not exist !");break;
case 8: printf("**8. Modification of hotel information **\n");
Info_Modify(head);break;
case 9: printf("**9. Deletion of hotel information **\n");
Delete_info(head);break;
case 10: printf("**10. Output of hotel information **\n");
Output_allInfo(head); break;
case 11:printf("11. Keep customer information ");
SaveInfoToFile(head); break;
// Save customer information to file
case 0:printf("**0. sign out **\n");
exit(0);
default: break;
}
}
return 0;
}
// Menu functions
char Display_Menu()
{
int i;
FILE *fp;
char ch;
printf("\n\n\n\n\n\n");
printf(" Welcome to the hotel information management system !") ;
if((fp=fopen("F:\\Cyy Report\\menu.txt","r"))==NULL)
{
printf(" Failed to open menu file !");
exit(0);
}
ch=fgetc(fp);
while(ch!=EOF)
{
putchar(ch);
ch=fgetc(fp);
}
printf("\n");
for(;;)
{
scanf("%d",&i);
printf("\n");
if(i<0||i>11)
printf(" Wrong choice , To choose :\n");
else break;
}
return i;
}
listnode *ReadInfoFromFile()
{
FILE *fp;
int b;
fp=fopen("F:\\Cyy Report\\customer.txt","r");
listnode *p=NULL,*q=NULL,*head=NULL;
p=(listnode *)malloc(sizeof(listnode));
head->next=p;
b=1;
if(!fp)
{
printf(" File opening failure !");
exit(0);
}
else printf(" File opened successfully ");
while(!feof(fp))
{
/*fprintf(fp,"%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",p->next->data.name,p->next->data.se x,p->next->data.ID, p->next->data.come,p->next->data.day,p->next->data.number,p->next->data.price,p->next->data. yajin,p->next->data.leave );*/
q=(listnode *)malloc(sizeof(listnode));
fscanf(fp,"%s%s%s%s%s%s%s%s",p->data.name,p->data.sex,p->data.ID,
p->data.come,p->data.day,p->data.number,p->data.price,p->data.yajin,p->data.leave);
p->next=q;
q=p ;
b++;
}
head=Add(head,b);
printf("\n");
fclose(fp);
return head;
}
// Establishment of hotel customer information
linklist Create(int a)
{
linklist head=(listnode *)malloc(sizeof(listnode));
listnode *p,*q;
q=head;
while(a--)
{
p=(listnode *)malloc(sizeof(listnode));
printf(" full name \t Gender \t certificates \t To stay in \t Days \t room number \t Price \t The deposit \t Leave \n ");
scanf("%s%s%s%s%s%s%s%s%s",p->data.name,p->data.sex,p->data.ID,
p->data.come,p->data.day,p->data.number,p->data.price,p->data.yajin,p->data.leave);
q->next=p;
q=p;
}
q->next=NULL;
return head;
}
listnode* Add(linklist head,int b)// Add customer information
{
listnode *m,*n,*p;
m=head;
n=m->next;
while(n->next!=NULL)
{
m=n;
n=n->next;
}
while(b--)
{
p=(listnode *)malloc(sizeof(listnode));
printf(" full name \t Gender \t certificates \t To stay in \t Days \t room number \t Price \t The deposit \t Leave \n ");
printf("***************************\n");
scanf("%s%s%s%s%s%s%s%s%s",p->data.name,p->data.sex,p->data.ID,
p->data.come,p->data.day,p->data.number,p->data.price,p->data.yajin,p->data.leave );
n->next=p;
n=p;
}
n->next=NULL;
return head;
}
// Find hotel information by name
listnode *Name_Search(linklist head)
{
listnode *p;
char name[10];
int i;
printf(" Press 1 Indicates name search :");
p=head->next ;
scanf("%d",&i);
if(i==1)
{
printf(" Enter the name you want to query :");
scanf("%s",&name);
while(p&&strcmp(p->data.name,name)>0)
p=p->next;
if(p==NULL||strcmp(p->data.name,name)<0)
p=NULL;
}
else
printf(" Input error !");
return p;
}
// Find hotel information by gender
listnode *Sex_Search(linklist head)
{
listnode *p;
char sex[10];
int i;
printf(" Press 1 Indicates gender search :");
scanf("%d",&i);
p=head->next ;
if(i==1)
{
printf(" Enter the gender to query :");
scanf("%s",&sex);
while(p&&strcmp(p->data.sex,sex)>0)
p=p->next;
if(p==NULL||strcmp(p->data.sex,sex)<0)
p=NULL;
}
return p;
}
// Find hotel information by room number
listnode *Roomnum_Search(linklist head)
{
listnode *p;
char number[10];
int i;
printf(" Press 1 Indicates room number search :");
p=head->next ;
scanf("%d",&i);
if(i==1)
{
printf(" Enter the room number to query :");
scanf("%s",&number);
while(p&&strcmp(p->data.number,number)>0)
p=p->next;
if(p==NULL||strcmp(p->data.number,number)<0)
p=NULL;
}
return p;
}
// Find by check-in time
listnode *Cometime_Search(linklist head)
{
listnode *p;
char come[10];
int i;
printf(" Press 1 Indicates gender search :");
p=head->next ;
scanf("%d",&i);
if(i==1)
{
printf(" Enter the check-in time to query :");
scanf("%s",&come);
while(p&&strcmp(p->data.come,come)>0)
p=p->next;
if(p==NULL||strcmp(p->data.come,come)<0)
p=NULL;
}
return p;
}
// Modify according to the information of the customer's name
void Info_Modify(linklist head)
{
listnode *p;
p=Name_Search(head);
if(p==NULL)
{
printf(" Hotel information does not exist !\n");
}
else
{
printf(" full name \t Gender \t certificates \t To stay in \t Days \t room number \t Price \t The deposit \t Leave \n ");
printf("***************************\n");
scanf("%s%s%s%s%s%s%s%s%s",p->data.name,p->data.sex,p->data.ID,
p->data.come,p->data.day,p->data.number,p->data.price,p->data.yajin,p->data.leave ); printf(" Hotel information has been modified !");
}
}
// Deletion of customer information
void Delete_info(linklist head)
{
int i;
listnode *p,*q;
p=Name_Search(head);
if(p==NULL)
{
printf(" Information does not exist !\n");
return;
}
else
{
printf(" Press 1 Delete :");
scanf("%d",&i);
if(i==1)
{
q=head;
while(q!=NULL&&q->next!=p)
q=p->next;
q->next=p->next;
free(p);
printf(" The message has been deleted !");
}
}
}
// Output of hotel information
void Output_allInfo(linklist head)
{
listnode *p;
p=head;
printf(" full name \t Gender \t certificates \t To stay in \t Days \t room number \t Price \t The deposit \t Leave \n ");
while(p->next!=NULL) {
printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",p->next->data.name,p->next->data.sex,p-> next->data.ID,
p->next->data.come,p->next->data.day,p->next->data.number,p->next->data.price,p->next->data. yajin,p->next->data.leave );
p=p->next ;
}
}
void SaveInfoToFile(linklist head)
{
FILE *fp;
listnode *p;
p=head->next;
if(p==NULL)
{
printf(" There is no customer information now , Please enter the customer information first !\n\n");
return;
}
fp=fopen("F:\\Cyy Report\\customer.txt","w");
if(!fp)
{
printf(" file does not exist !\n");
return;
}
while(p)
{
fprintf(fp,"%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n",p->data.name,p->data.sex,p->data.ID, p->data.come,p->data.day,p->data.number,p->data.price,p->data.yajin,p->data.leave );
p=p->next;
}
fclose(fp);
printf(" File saved successfully !\n");
}
边栏推荐
- What is prescaler in STM32
- 【功能测试】项目的测试——登录和发布文章功能
- Try... Finally summary
- Examples of map search
- Buckle practice - 30 set the intersection size to at least 2
- VMware virtual machine and vSphere migrate to each other
- Force deduction exercise - 26 split array into continuous subsequences
- How to upload pictures from typora to CSDN
- Snowflake algorithm (PHP)
- 泰山OFFICE技术讲座:段落边框的布局难点
猜你喜欢
如何用WebGPU流畅渲染百万级2D物体?

Zhihuihuayun | cluster log dynamic collection scheme

Implementing deep learning framework from zero -- further exploration of the implementation of multilayer bidirectional RNN

6-16漏洞利用-rlogin最高权限登陆

QT notes - qtablewidget table spanning tree, qtreewidget tree node generates table content
![[function test] test of the project - login and post function](/img/64/c9bbf34964622f4f013b1184eeb1e0.jpg)
[function test] test of the project - login and post function

基于Kubernetes v1.24.0的集群搭建(一)

Do you regret learning it?

QT notes - sort a column specified by qtablewidget

Conference publishing function of conference OA project
随机推荐
【Rust】引用和借用,字符串切片 (slice) 类型 (&str)——Rust语言基础12
Error: [synth 8-439] module 'xxx' not found not found error solution
月薪 3万人民币是一种怎样的体验?做自媒体可以达到这种水平吗
Acwing 92. recursive implementation of exponential enumeration
MES系统设备管理概述(中)
Threat hunting collection
The biggest crisis for testers in the workplace is not at the age of 30, but being laid off in middle age
Is there a free and commercially available website for US media video clips?
Leecode-268. missing numbers (Application of XOR, find numbers that do not appear, find numbers that only appear once)
QT notes - sort a column specified by qtablewidget
Slow motion animation, window related data and operations, BOM operations [DOM (V)]
for mysql
Why is there discontinuity in MySQL auto increment primary key?
QT | summary of the use of edit box
Basic SQL server operation problems - only when lists are used and identity_ Only when insert is on can the display value be set for the identification column in the table
thinkphp 实现数据库备份
Wechat official account development: Material Management (temporary and permanent)
[rust] reference and borrowing, string slice type (& STR) - rust language foundation 12
Pushgateway installation and Prometheus configuration
How to render millions of 2D objects smoothly with webgpu?