A Code On C Programming For Hotel Management
A Code On C Programming For Hotel Management
#include<conio.h>
#include<string.h>
#include<time.h>
#include<stdlib.h>
void program();
void show_details();
void complaints_suggestions();
void book_room();
void mini_casino();
void GuessGame();
char name[20];
char address[50];
char email_id[30];
char nationality[25];
int roomno;
char *roomtype;
int billprice;
char *program;
}person;
int main(){
person.roomno =0;
person.billprice =0;
person.program = "notchosen";
gets(person.name);
gets(person.address);
gets(person.nationality);
gets(person.email_id);
system("cls");
begin();
return 0;
void begin(void){
int decide;
printf("\n-----------------------HOME PAGE--------------------------\n");
scanf("%d",&decide);
switch(decide)
case 1:
book_room();
break;
case 2:
program();
break;
case 3:
mini_casino();
break;
case 4:
show_details();
break;
case 5:
complaints_suggestions();
begin();
break;
case 6:
printf("Visit again!");
break;
case 7:
printf(" A beautiful cosmopolitan destination for a picturesque natural scenario, a blend of Natural
and Artificial effort located on the border of");
printf("Chitwan National park (A UNESCO World Heritage Site) allows you to enjoy the breeze of
Rapti River flowing through the lap of Chitwan National Park.");
printf("Enjoying the spectacular sunset and its reflection on Rapti River along with grazing of deer
on the bank by relaxing on our rugged cottages");
printf("is the memorable experience you could enjoy only at GHUMTEE RIVERA RESORT. \n");
printf("We would be more than happy to experience you Jungle Safari, canoe ride to Crocodile
Breeding Farm and Ox-Cart ride.");
printf("Clean and Comfortable room, Hot and Cold Water facilities, beautiful garden, family
environment, local food are our salient features to give you taste of our Nepalese Culture.");
printf("Satisfying you totally with our unique culture is our primary motto.\n");
begin();
break;
void book_room(void){
system("cls");
if(person.roomno == 0){
int type_of_rooms;
char ch,c;
scanf("%d",&type_of_rooms);
fflush(stdin);
if(type_of_rooms==1){
fflush(stdin);
scanf("%c",&c);
if (c=='y'){
system("cls");
person.roomno = 121;
person.roomtype = "basic";
person.billprice += 1000;
begin();
else
begin();
if(type_of_rooms==2){
scanf("%c",&c);
if(c=='y'){
system("cls");
person.billprice += 2000;
person.roomno = 212;
person.roomtype = "medium";
begin();}
else
begin();
if(type_of_rooms==3){
scanf("%c",&c);
if(c=='y'){
system("cls");
person.billprice += 3000;
person.roomtype = "deluxe";
person.roomno = 312;
begin();
else
begin();
if(type_of_rooms==4)
begin();
else
void program(void){
system("cls");
int p;
printf("\n 1.Jungle Walk \n 2.Jungle Jeep Drive\n 3.Canoe ride \n 4. Cultural show ");
scanf("%d",&p);
switch(p){
case 1:
system("cls");
person.billprice += 1000;
begin();
break;
case 2:
person.billprice += 2000;
begin();
break;
case 3:
person.billprice+= 800;
begin();
break;
case 4:
person.billprice+= 1000;
begin();
break;
default:
begin();
}
void show_details(void){
system("cls");
FILE *ifp;
ifp = fopen("hotel.txt","w+");
if(ifp == NULL){
else{
fprintf(ifp,"........DETAILS......\n");
fprintf(ifp,"Name : %s\n",person.name);
fprintf(ifp,"Nationality : %s\n",person.nationality);
fprintf(ifp,"Email id : %s\n",person.email_id);
fprintf(ifp,"Address : %s\n",person.address);
fprintf(ifp,"Roomno : %d\n",person.roomno);
fprintf(ifp,"Roomtype : %s\n",person.roomtype);
if(strcmp(person.program,"notchosen") != 0){
fprintf(ifp,"Program : %s\n",person.program);
fflush(ifp);
fclose(ifp);
begin();
void complaints_suggestions(void){
system("cls");
char complain[500];
FILE *fpt;
if(fpt == NULL){
fflush(stdin);
gets(complain);
fpt = fopen("complain.txt","w+");
fputs(complain,fpt);
fclose(fpt);
srand((time(NULL)));
int i, x, y, temp;
x = rand() % 3;
y = rand() % 3;
temp = num[x];
num[x] = num[y];
num[y] = temp;
int PlayerGuess;
scanf("%d", &PlayerGuess);
if (num[PlayerGuess - 1] == 'R') {
(*inhand_cash) += 2 * amount_bet;
else {
(*inhand_cash) -= amount_bet;
void mini_casino()
/*
*/
scanf("%d", &inhand_cash);
scanf("%d", &amount_bet);
if (inhand_cash == 0 || amount_bet > inhand_cash)
break;
else
GuessGame(amount_bet, &inhand_cash);
printf("\n\""
" \nSorry you don't have enough cash to play more,\n ");
"\n\n");