当前位置:网站首页>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");
}
边栏推荐
- 突破内存墙能带来什么?看火山引擎智能推荐服务节支增效实战
- Most after analyze table in PostgreSQL_ common_ Why is the elems field not filled in?
- Do you regret learning it?
- MySQL common functions
- Buckle practice - 24 remove repeated letters
- Slow motion animation, window related data and operations, BOM operations [DOM (V)]
- Reserved instances & Savings Plans
- Understand what goals the MES system can achieve
- Say no to blackmail virus, it's time to reshape data protection strategy
- 做自媒体视频剪辑有免费可商用的素材网站吗?
猜你喜欢

【Rust】引用和借用,字符串切片 (slice) 类型 (&str)——Rust语言基础12

QT notes - realize form adaptation

Opencv:08 image pyramid

SQL JOIN 入门使用示例学习左连接、内连接、自连接

如何在IM系统中实现抢红包功能?

Installation and deployment of ansible

微信公众号开发:素材管理(临时、永久)

leetcode:51. N 皇后

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

What is prescaler in STM32
随机推荐
Calculate the distance between the longitude and latitude of two coordinates (5 ways)
Microsoft SQL Server database language and function usage (XII)
Most after analyze table in PostgreSQL_ common_ Why is the elems field not filled in?
支持刘海屏
nacos部署
三层交换机配置MSTP协议详解【华为eNSP实验】
Ansible的安装及部署
微信小程序-绘制仪表盘
SSH服务突然连接不了案例总结
C Advanced - data storage
Guys, do you need to configure anything to use rocksdb when using flinksql? Or do you need any jar packages
[leetcode]- linked list-3
泰山OFFICE技术讲座:段落边框的布局难点
Unity rotation test
How to realize the function of grabbing red envelopes in IM system?
Buckle practice - 24 remove repeated letters
Buckle practice - 25 non overlapping intervals
ThinkPHP realizes database backup
[data mining engineer - written examination] sheen company in 2022
有没有2、3w前期适合一个人干的创业项目呢?做自媒体可以吗?