













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Every major buisness requires storing information of clients, our idea aims to store clients data using data structures. In this project we have aimed at providing this service as Database management of a hotel. Our program takes in username, Mobile number and email id as input, and can perform various operations such as storing, modification, displaying, and deletion. Since we are using the concept of files and linked list we are able to store data efficiently and safely without risking much da
Typology: Study Guides, Projects, Research
1 / 21
This page cannot be seen from the preview
Don't miss anything!














Mini Project Report
MINI-HOTEL MANGEMENT
By
Guide:
Department of Computer Engineering Off Carter Road, Bandra (W), Mumbai - 400050.
by ROHIT NAIR (49), MOMIN ARZAN (52), HUZEFA ARIELWALA (55),ABID
requirement for the award of the second year of Engineering in Computer Engineering from University of Mumbai. Certified By
Project Guide
Sr. No Title 1 2 Requirements 1.1. Hardware Requirements 1.1. Software Requirements 2.1 Algorithm 2.2 Program and Output 2.3 Conclusion 2.4 Future Scope References
3.2 Algorithm: Step 1: START Step 2: Delare Functions that are requried in program void clearInput(void), void addNewroom(void), void listAll(void) void deleteroom(void), void modifyroom(void), int findroom(void), int prompt(void), int findnum (int). Step 3: Define Struct room Containing int number ( unique room number), char name[20](contains name),char phone[15] (contains phone number), char email[20] (contains email address) also *next pointer Step 4 : create file declare file name, open file for reading, make record by using struct, pointer referencing next node, close file Step 5: print menu messages Use switch case for menu selection and call the function requried Step 6: define the functions void addNewroom(void) take the room records from the user by using struct room void listAll(void) display all the room records available in the file void deleteroom(void) show all room number then take room no. from the user that has to be delete. Remove the records of that room no void modifyroom(void) modify the room detail of specified room no entered by user int findroom(void) find room records by name specified by user step 8: STOP
3.4 Program and Output: #include <stdio.h> #include <malloc.h> #include <string.h> #include <ctype.h> /* Define Functions/ int cnum=0; void clearInput(void); void addNewroom(void); void listAll(void); void deleteroom(void); void modifyroom(void); int findroom(void); int prompt(void); int findnum (int); / Define Structures/ typedef struct room { int number; /unique account number/ char name[20]; /contains name/ char phone[15]; /contains phone number/ char email[20]; /contains email address/ struct room next; /next is used to navigate through structures./ int count; } Room; Room firstc,currentc,newc; /pointers*/
do { fflush(stdin); puts("\nWelcome To The hotel Database"); puts("-- -----------------------------"); puts("1 - Add a new room details"); puts("2 - Delete history of room details"); puts("3 - List all room and room details"); puts("4 - Modify room details"); puts("5 - Find a room detail by name"); puts("-- -----------------------------"); puts("Q - Save and quit\n"); printf("\tYour choice:"); ch = getchar(); ch = toupper(ch);/changes user input case to upper case/ switch(ch) { case '1': puts("Add a new room details \n"); fflush(stdin); addNewroom(); break; case '2': puts("Delete a room details \n"); deleteroom(); break; case '3': puts("List all room details \n");
listAll(); break; case '4': puts("Modify a room details \n"); modifyroom(); break; case '5': puts("Find a room by name\n"); findroom(); break; case 'Q': puts("Save and quit\n"); default: break; } } while(ch != 'Q'); currentc = firstc; if(currentc == NULL) return(0); datafile = fopen(filename,"w"); /open file to write/ if(datafile == NULL) { printf("Error writing to %s\n",filename); return(1); } while(currentc != NULL)
gets(currentc->email); printf("******** room details added ******** "); currentc->count=0; currentc->next = NULL; } void listAll(void) /* list all room details function/ { if(firstc==NULL) puts("There are no room details to display!"); else { printf("%6s %-20s %-15s %-15s\n","Acct#","Name","Phone","Email"); puts("------ -------------------- ------------- -------------------"); currentc=firstc; do { printf("%6d: %-20s %-15s %-20s\n",
currentc->number,
currentc->name,
currentc->phone,
currentc->email); /prints values of number, name, phone and email/ } while((currentc=currentc->next) != NULL); } } void deleteroom(void) /delete contact function */ {
int record; struct room previousa; if(firstc==NULL) { puts("There are no room details to delete!"); return; } listAll(); / show all records*/ printf("Enter room number to delete: "); scanf("%d",&record); currentc = firstc; while(currentc != NULL) { if(currentc->number == record) { if(currentc == firstc) firstc=currentc->next; free(currentc); printf("room deatils %d deleted!\n",record); return; } else { currentc = currentc->next; } } printf("room details %d not found!\n",record); }
int findnum (int recordnum) { int record; record = recordnum; currentc = firstc; while(currentc != NULL) { if(currentc->number == record) { return 1; } else { currentc = currentc->next; } } return -1; } int findroom(void) /* find contact function/ { char buff[20]; if(firstc==NULL) { puts("There are no room details to find!"); return 1; } printf("Enter room name: "); fflush(stdin);/clears any text from the input stream*/
gets(buff); currentc = firstc; while(currentc != NULL) { if( strcmp(currentc->name, buff) == 0 ) { printf("%6s %-20s %-15s %-15s\n","Acct#","Name","Phone","Email"); /prints table titles/ printf("%6d: %-20s %-15s %-20s\n",
currentc->number,
currentc->name,
currentc->phone,
currentc->email); return 0; } else { currentc = currentc->next; } } printf("contact %s was not found!\n",buff); return 1; } int prompt(void) { char ch; fflush(stdin); printf("Update? (Y to update any other key to not)"); ch = getchar(); ch = toupper(ch);