56% found this document useful (9 votes)
10K views48 pages

C++ Project On Hotel Room Reservation

C++ coding in .docx format about HOTEL ROOM RESERVATION SYSTEM BOok RoOms,Check-ouT,Pay Advance, Shopw RoOm, modiFy any roOm.... dO anytHinG....
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
56% found this document useful (9 votes)
10K views48 pages

C++ Project On Hotel Room Reservation

C++ coding in .docx format about HOTEL ROOM RESERVATION SYSTEM BOok RoOms,Check-ouT,Pay Advance, Shopw RoOm, modiFy any roOm.... dO anytHinG....
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Computer Science

Project File

of
Ashwani Kumar Jha
XIIth-A
Board Roll No.
___________

*******
Hotel Room
Reservation
System

//header files included.


#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<process.h>
#include<dos.h>
#include<ctype.h>
///////////////////////////////////////////////////////////////////////////////////////////////

date indate(int &);


int readcust(int &, char *, unsigned long &, unsigned long &,date &);
void operate();
void roommenu();
void reserve();
void leaveroom();
void query();
void payme();
void querymenu();
void searchroom();
void searchcust();
void noocc();
void nounocc();
void nofrs();
void querymainmenu();
void updateroom();
void delroom();
void show_all_room();
void insertroom();

/////////////////////////////////////////////////////////////////////////////

//room class begins HERE.


class room{

char rtype[20];

public:

int rstatus; //room no. & status


int rno;
long double rate;

room()
{
rstatus=0;
}

retstatus()
{
return rstatus;
}

char* retroomtype()
{
return rtype;
}

void addroom() //To Add Room


{
clrscr();
int c;

cout<<"\nRoom No.:\t"<<rno;

cout<<"\nEnter Suite Type:";


cout<<"\n\n1. Single AC\n";

cout<<"2. Single NonAC\n";

cout<<"3. Double AC\n";


cout<<"4. Double NonAC\n";
cout<<"5. Luxury\n\n";
cin>>c;

switch(c)
{

case 1:strcpy(rtype,"Single AC");


rate=3000;
break;
case 2:strcpy(rtype,"Single NonAC");
rate=2000;
break;
case 3:strcpy(rtype,"Double AC");
rate=6000;
break;
case 4:strcpy(rtype,"Double NonAC");
rate=4500;
break;
case 5:strcpy(rtype,"Luxury");
rate=9000;
break;
default: cout<<"Wrong Choice...!!";
};
getch();
clrscr();

void modify()
{
clrscr();

int n;

cout<<"\nEnter New Suite Type:";

cout<<"\n\[Link] AC\n";

cout<<"[Link] NonAC\n";

cout<<"[Link] AC\n";

cout<<"[Link] NonAC\n";

cout<<"[Link]\n";
cin>>n;
switch(n)
{
case 1:strcpy(rtype,"Single AC");
rate=3000;
break;
case 2:strcpy(rtype,"Single NonAC");
rate=2000;
break;
case 3:strcpy(rtype,"Double AC");
rate=6000;
break;
case 4:strcpy(rtype,"Double NonAC");
rate=4500;
break;
case 5:strcpy(rtype,"Luxury");
rate=9000;
break;
}

getch();
clrscr();
}

void showroom() //To Display Details of Room.


{
char rsta[15];
clrscr();
cout<<"\nRoom Number:\t"<<rno;
cout<<"\nRoom Type :\t";
puts(rtype);
cout<<"\nRoom Rate :\t"<<"Rs."<<rate;

if(rstatus==0)
strcpy(rsta,"Unoccupied");
else
strcpy(rsta,"Occupied");

cout<<"\nRoom Status:\t";
puts(rsta);
cout<<"\n\nPRESS ANY KEY TO CONTINUE !";

getch();
clrscr();
}
}; //end of [ room ] class

/////////////////////////////////////////////////////
//cust class begins HERE.

class cust{

char room_type[20],cname[50],add[100],pno[11];

date check_in, check_out;


public:

int room_no;

long double adamt,bal;

char* retcname()
{
return cname;
}

retcustroom_no()
{
return room_no;
}

int input()
{
clrscr();
cout<<"\n\n\Enter Customer's Name :\t";
gets(cname);
cout<<"\n\nEnter Customer's Address :\t";
gets(add);
cout<<"\n\nEnter Customer's Phone Number:\t";
cin>>pno;
getdate(&check_in);
int f=readcust(room_no,room_type,adamt,bal,check_out);
return(f);
}

void showcust()
{
clrscr();

cout<<"\n\nCustomer Name :";


puts(cname);
cout<<"\nCustomers phone number:";
cout<<pno;
cout<<"\nRoom No. :";
cout<<room_no;
cout<<"\nRoom Type : ";
puts(room_type);
cout<<"\nTotal Rent : ";
cout<<adamt+bal;
cout<<"\nAdvance : ";
cout<<adamt;
cout<<"\nBalance : ";
cout<<bal;

printf("\nThe Check in year is : %d\n", check_in.da_year);


printf("\nThe Check in Month is: %d\n", check_in.da_mon);
printf("\nThe Check in Date is : %d\n", check_in.da_day);

printf("\nThe checkout year is : %d\n", check_out.da_year);


printf("\nThe checkout Date is : %d\n", check_out.da_day);
printf("\nThe checkout Month is: %d\n", check_out.da_mon);

getch();
clrscr();

}; //end of class cust.

//here, ask user for room type, no. of days to stay


//also ask him to pay 50% of total rent in advance
int readcust(int &room_no, char *type, long double &adm, long double &bal,date &check_out)
{

room r;
ifstream f;
unsigned long advance;
int t,s;
int flag;
struct date d;
cout<<"\n\nEnter The Type Of Suit Customer Wants:\t\n";
do{
void menu();
cout<<"\nEnter Suite Type:";

cout<<"\n [Link] AC Rs.3000";

cout<<"\n [Link] NonAC Rs.2000";

cout<<"\n [Link] AC Rs.6000";

cout<<"\n [Link] NonAC Rs.4500";

cout<<"\n [Link] Rs.9000";


cout<<"\n\nIf You Don't Want to Continue, Press Any Other Number ! \n\n\t\t";
cin>>t;
if(t>5 || t<1)
return 1;
char rtype[20];

switch(t)
{
case 1:strcpy(rtype,"Single AC");
[Link]=3000;
break;
case 2:strcpy(rtype,"Single NonAC");
[Link]=2000;
break;
case 3:strcpy(rtype,"Double AC");
[Link]=6000;
break;
case 4:strcpy(rtype,"Double NonAC");
[Link]=4500;
break;
case 5:strcpy(rtype,"Luxury");
[Link]=9000;
break;
}

[Link]("[Link]" , ios::binary);
if(!f)
{
cout<<"\n\t\t\tERROR !!";
return 1;
}
[Link]((char*)&r , sizeof(r));
while(f)
{

if(strcmp(rtype,[Link]()) == 0 && [Link]() == 0)


{
[Link]=1;
[Link]();
break;
}

[Link]((char*)&r , sizeof(r));

if([Link]())
{
flag=1;
clrscr();
cout<<"\n\nRoom Requested Is NOT AVAILABLE ! \n Please Enter Another Room Type !";
clrscr();
[Link]();

else
{
flag=0;

}while(flag!=0);
d=indate(s);
int rent=s*[Link];
char a;
cout<<"\n\nYour Amount Payable is :\t"<<"Rs."<<rent<<"\n";
do{
cout<<"\nPlease pay 50% amount now :\t"<<"Rs.";
cin>>advance;

cout<<"\n\nDo you want to stay(only y/n) : ";


cin>>a;

}while(advance<rent/2&& a=='y');

if(a=='y'&& advance>=rent/2)
flag=0;
else
flag=1;
clrscr();
room_no=[Link];
strcpy(type,[Link]());
adm=advance;
bal=rent-advance;
check_out=d;
printf("\nThe current year is: %d\n", d.da_year);
printf("\nThe current day is: %d\n", d.da_day);
printf("\nThe current month is: %d\n", d.da_mon);
clrscr();
return flag;

void custenter()
{
clrscr();
cust c;
ofstream f("[Link]",ios::binary|ios::app);
if(!f)
{
cout<<"\nError......";
return;
}
if ([Link]()==0)
[Link]((char*)&c,sizeof(c));
[Link]();
clrscr();
getch();
clrscr();
}

void showcustomer()
{

clrscr();

cust c;
ifstream f ("[Link]" , ios::binary);
if(!f)
{
cout<<"\nError..........";
return;
}
[Link]((char*)&c , sizeof(c));
while(f)
{
[Link]();
[Link]((char*)&c, sizeof(c));
}
[Link]();
clrscr();
}

struct date indate(int &s) //Work With Check-In & Check Out Dates
{
int day,mon,year;
struct date d, d1;
getdate(&d); // (from dos.h) ,takes current date from system
d1=d;
printf("\nThe current year is: %d\n", d.da_year);
printf("\nThe current day is: %d\n", d.da_day);
printf("\nThe current month is: %d\n", d.da_mon);
int mo[]={31,29,31,30,31,30,31,31,30,31,30,31};
cout<<"\n\n\nEnter Days to Be Add :\t";
cin>>s;
day=d.da_day;
mon=d.da_mon;
year=d.da_year;

int s1=int(d.da_day)+s;
do{
if(d.da_mon==2 && d.da_year%4==0)

{
if(s1>29)
{ d.da_mon++;
s1-=29;
}}
else
if(d.da_mon==2 && d.da_year%4!=0)
{

if(s1>28)
{ d.da_mon++;
s1-=28;
}
}

switch(d.da_mon)
{
case 4:
case 6:
case 9:
case 11:
if(s1>30)
{
d.da_mon++;
s1-=30;
}
break;
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
if(s1>31)
{
d.da_mon++;
s1-=31;
}
break;
case 12:
if(s1>31)
{
d.da_mon=1;
d.da_year ++;
s1-=31;
} }
}while(mo[d.da_mon-1]<s1);

d.da_day=s1;
printf("\nThe checkout year is: %d\n", d.da_year);
printf("\nThe checkout day is: %d\n", d.da_day);
printf("\nThe checkout month is: %d\n", d.da_mon);

getch();
return d;
}

/////////////////////////////////////////////////////////////////////////////

//To main Menu(Main Screen)


void fun()
{
int i;
textcolor(YELLOW);
clrscr();

gotoxy(35,12);
cout<<"LOADING DATA !";
}

void bar()
{
int i,x=22,x1=22;

for(i=0;i<40;i++)
{
gotoxy(x,18);
cout<<"°";
x++;
}
textcolor(DARKGRAY);
for(i=0;i<40;i++)
{
gotoxy(x1,18);
cprintf("°");
x1++;
delay(100);
}

}
void menu()
{
clrscr();
textcolor(YELLOW);

gotoxy(33,10);
cprintf("LOADING MENU");
for(int n=0;n<5;n++)
{
delay(1000);
cprintf(".");
}
clrscr();
textcolor(LIGHTGREEN);
int y1=4,y=4,i;
clrscr();
gotoxy(25,4);
for(i=0;i<15;i++)
cout<<"**";
for(i=0;i<19;i++)
{
gotoxy(25,y1);
cout<<"**";
y1++;
}
gotoxy(25,23);
for(i=0;i<15;i++)
cout<<"**";

for(i=0;i<19;i++)
{
gotoxy(53,y);
cout<<"**\n";
y++;
}
textcolor(LIGHTCYAN);
gotoxy(38,5);
cprintf("MENU");
}

void mainmenu()
{
clrscr();
int c=0,i,j;
while (c<=5)
{
textcolor(LIGHTCYAN);
gotoxy(38,5);
cprintf("MENU");
textcolor(WHITE);
gotoxy(27,7);
cprintf("[Link] Rooms");
gotoxy(27,9);
cprintf("[Link] a Room");
gotoxy(27,11);
cprintf("[Link] A Room");
gotoxy(27,13);
cprintf("[Link]");
gotoxy(27,15);
cprintf("[Link] ");
gotoxy(27,17);

cin>>c;
gotoxy(27,15);
cout<<" ";

switch(c)
{
case 1:roommenu();
break;
case 2:reserve();
break;
case 3:leaveroom();
break;
case 4:query();
break;
case 5:operate();
break;
default : cout<<"Enter valid choice.............:";
break;

}
//end of Main Screen

////////////////////////////////////////////////////////////////////////////////////

void roommenu()
{
int c;
clrscr();
menu();
textcolor(WHITE);
gotoxy(27,7);
cprintf("[Link] Room");
gotoxy(27,8);
cprintf("[Link] Room");
gotoxy(27,9);
cprintf("[Link] A Room");
gotoxy(27,10);
cprintf("[Link] all Rooms");

gotoxy(27,11);
cprintf("[Link] Back To Main Menu ");
cin>>c;

switch(c)
{
case 1:insertroom();
break;
case 2:updateroom();
break;
case 3:delroom();
break;
case 4:show_all_room();
break;
case 5:{
clrscr();
mainmenu();
}
break;
}
}

//functions inside room menu


//////////////////////////////////////////////////////////////////////////

void insertroom() //To Write in the Room file


{
clrscr();
int x;
room r;
ifstream f("[Link]",ios::binary);
if(!f)
{
[Link]=100;
}
[Link]((char*)&r , sizeof(r));
while(f)
{
[Link]((char*)&r , sizeof(r));
}
[Link]+=1;
[Link]();
[Link]();
ofstream f1("[Link]" , ios::binary | ios::app);
if(!f1)
{
cout<<"Error....!!";
clrscr();
}
[Link]((char*)&r,sizeof(r));
[Link]();
clrscr();
getch();
}

void delroom() //delete room


{
clrscr();
int rono;
room r;
ifstream f3("[Link]",ios::binary);
ofstream f4("[Link]",ios::binary);
if(!f3||!f4)
{
cout<<"\nFile Error...!!!";
return;
}
int flag=0;
char ch;
cout<<"\nEnter the Room No. to be Deleted:\t";
cin>>rono;
[Link]((char*)&r , sizeof(r));
while(f3)
{
if(rono!=[Link] || [Link]()==1)
[Link]((char*)&r , sizeof(r));
else
{
[Link]();
cout<<"\n\nDo You Really Want To Delete ?(Y/N)\t";
cin>>ch;

if(ch=='y'||ch=='Y')
flag=1;
else
{
flag=2;
[Link]((char*)&r,sizeof(r));
}

[Link]((char*)&r , sizeof(r));

[Link]();
[Link]();
remove("[Link]");
rename("[Link]" , "[Link]");
if(flag==0)
cout<<"\n\nRoom number Cannot Be Deleted!!!" ;
else
if(flag==1)
cout<<"\n\nRoom number "<<rono<<" deleted !!!\n\n";
else
cout<<"\n\nDeletion Suspended\n\n";

getch();
clrscr();
}
void updateroom() //update the room
{
clrscr();
int rono;
room r;
fstream f2("[Link]",ios::binary|ios::in|ios::out);

if(!f2)
{
cout<<"\nError......";
return;
}

cout<<"\n\nEnter the Room No. Whose Details Are to be Modified :\t";


cin>>rono;

[Link]((char*)&r , sizeof(r));

while(f2)
{
if(rono==[Link] && [Link]()==0)
{
[Link]();
[Link]([Link]()-sizeof(r));
[Link]((char*)&r,sizeof(r));
break;
}
[Link]((char*)&r , sizeof(r));
}

if([Link]())
cout<<"\n\nRoom No. either Not Present or Already Reserved !";
[Link]();
clrscr();
}

void show_all_room()
{
clrscr();

int c=0;
room r;
ifstream f3("[Link]",ios::binary);
if(!f3)
{

cout<<"\nFile Error...!!!";
return;
}

[Link]((char*)&r , sizeof(r));
while(f3)
{
c++;
[Link]();
[Link]((char*)&r , sizeof(r));
}
[Link]();

if(c==0)
{
cout<<"\n\n\t\tNo Room Exists.........";
clrscr();
}
}
//end of room menu functions

//reserve a room & check-out a room start here.


//////////////////////////////////////////////////////////////////////////////////
void reserve()
{
clrscr();
cust c;
ofstream f("[Link]" , ios::binary);
if(!f)
{
cout<<"\nError !";
return;
}
[Link]();
[Link]((char*)&c , sizeof(c));
[Link]();
}
void leaveroom() //To CheckOut Room & change Status & pay Bill
{

int rono;
cust c;
room r;
unsigned long balanc;
clrscr();
gotoxy(35,2);
cout<<"LEAVE ROOM";

fstream f ("[Link]",ios::binary|ios::in|ios::out) ;
ifstream f3("[Link]",ios::binary);
ofstream f4("[Link]",ios::binary);
if(!f||!f3||!f4)
{
cout<<"\nFile Error...!!!";
return;
}
int flag=0;
char ch;
cout<<"\nEnter the Room No. : \t";
cin>>rono;
[Link]((char*)&c , sizeof(c));
while(f3)
{
if(rono!=c.room_no )
[Link]((char*)&r , sizeof(r));
else
{
[Link]();
cout<<"\n\nDo You Really Want To LEAVE ?(Y/N)\t";
cin>>ch;

if(ch=='y'||ch=='Y')
{
flag=1;

cout<<"\n\nTotal Amount :\t"<<" Rs. "<<[Link]+[Link];


cout<<"\n\nAmount Payed :\t"<<" Rs. "<<[Link];
cout<<"\n\nBalance left :\t"<<" Rs. "<<[Link];
while(balanc!=[Link])
{
cout<<"\n\nPay Balance :\t"<<" Rs. ";
cin>>balanc;
}

[Link]((char *)&r ,sizeof(r));


while(f)
{
if([Link]==rono)
[Link]=0;
[Link]((char*)&r , sizeof(r));
}

cout<<"\n\n\tAll Dues Cleared...!";


getch();
}
else
{
flag=2;
[Link]((char*)&r,sizeof(r));
}

[Link]((char*)&r , sizeof(r));

[Link]();
[Link]();
remove("[Link]");
rename("[Link]" , "[Link]");
if(flag==0)
cout<<"\n\nRoom number "<<rono<<" is not vacant!!!" ;
else
if(flag==1)
cout<<"\n\nRoom number "<<rono<<" is vacant now!!!\n\n";
else
cout<<"\n\nLeaving Suspended\n\n";
getch();

clrscr();

///////////////////////////////////////////////////////////////////////////////////
// Query part begins here.
///////////////////////////////////////////////////////////////////////////////////

void query()
{
querymenu();

querymainmenu();

getch();
}

void querymenu()
{
clrscr();
textcolor(YELLOW);

cprintf("LOADING QUERY");
for(int n=0;n<5;n++)
{
delay(1000);
cprintf(".");
}
clrscr();
highvideo();

textcolor(LIGHTCYAN);
gotoxy(38,5);
cprintf("QUERY");

void querymainmenu()
{
int c=0,i,j;
while (c<=6)
{
textcolor(WHITE);
gotoxy(27,7);
cprintf("[Link] a Room");
gotoxy(27,8);
cprintf("[Link] a Customer");
gotoxy(27,9);
cprintf("[Link] Of Occupied Rooms");
gotoxy(27,10);
cprintf("[Link] of Unoccupied Rooms");
gotoxy(27,11);
cprintf("[Link] Of Free Rooms of Specific Type");
gotoxy(27,12);
cprintf("[Link] Menu");
gotoxy(27,14);
cin>>c;
gotoxy(27,14);
cout<<" ";

switch(c)
{
case 1:searchroom();
break;
case 2:searchcust();
break;
case 3:noocc(); //no. of occupied rooms
break;
case 4:nounocc(); //no. of unoccupied rooms
break;
case 5:nofrs(); //no. of free rooms of specific type
break;
case 6:{
clrscr();
mainmenu();
}
break;
}
}
getch();
}

void nofrs() //no. of free rooms of specific type


{
clrscr();
room r;
int snac=0,dnac=0,sac=0,dac=0,lux=0; //single non ac,double non ac,single ac,double ac,luxury

ifstream f("[Link]",ios::binary);

if(!f)
{
cout<<"\n\tERROR.................";
return;
}

[Link]((char*) &r , sizeof(r));

while(f)

if([Link]==0)
{

if(strcmpi([Link](),"Single AC")==0)
sac++;
else
if(strcmpi([Link](),"Single NonAC")==0)
snac++;
else
if(strcmpi([Link](),"Double AC")==0)
dac++;
else
if(strcmpi([Link](),"Double NonAC")==0)
dnac++;
else
if(strcmpi([Link](),"LUXURY")==0)
lux++;

[Link]((char*) &r , sizeof(r));

}
if(sac==0 && snac==0 && dac==0 && dnac==0 && lux==0)
cout<<"\n\n\tNo room Is free..All rooms are occupied.............";

else

cout<<"\n\tSingle AC : "<<sac;
cout<<"\n\n\tSingle Non AC : "<<snac;
cout<<"\n\n\tDouble AC : "<<dac;
cout<<"\n\n\tDouble Non AC : "<<dnac;
cout<<"\n\n\tLUXURY : "<<lux;

[Link]();

getch();
clrscr();
mainmenu();
}

void noocc() //no. of occupied rooms


{
clrscr();

room r;
int c=0;
ifstream f("[Link]",ios::binary);

if(!f)
{
cout<<"\n\tERROR.................";
return;
}

[Link]((char*) &r , sizeof(r));


while(f)
{
if([Link]==1)
c++;
[Link]((char*) &r , sizeof(r));
}

if(c==0)
cout<<"\n\n\tNo room Is Occupied..All rooms are free.............";

[Link]();

getch();
clrscr();
mainmenu();
}

void nounocc() //no. of unoccuipied rooms


{
clrscr();
room r;
int c=0;
ifstream f("[Link]",ios::binary);

if(!f)
{
cout<<"\n\tERROR.................";
return;
}
[Link]((char*) &r , sizeof(r));
while(f)
{
if([Link]==0)
{
c++;
[Link]();
}
[Link]((char*) &r , sizeof(r));
}
if(c==0)
cout<<"\n\n\tNo room Is free..All rooms are occupied.............";
[Link]();
getch();
clrscr();
mainmenu();

void searchroom() //search a room no.


{

clrscr();

int srno;
cout<<"\nEnter the room no. You want to search:\t";
cin>>srno;
room r;
cust c;
ifstream f("[Link]" , ios::binary);
ifstream f1("[Link]", ios::binary);
if(!f||!f1)
{
cout<<"\nError";
return;
}
[Link]((char*)&r , sizeof(r));
[Link]((char*)&c , sizeof(c));
while(f)
{
if(srno==[Link] && srno==c.retcustroom_no())
{[Link]();
break;
}
else
if(srno==[Link])
{
[Link]();
break;
}
[Link]((char*)&r , sizeof(r));
[Link]((char*)&c , sizeof(c));
}
if([Link]())
cout<<"\nNot Found... Make Sure that You"<<"\nHave Entered Correct Room No.!";
[Link]();
getch();
clrscr();
mainmenu();
}

void searchcust() //search a customer name


{

clrscr();

char name[50];
cout<<"\nEnter the Customer Name to search:\t";
gets(name);
cust c;
ifstream f("[Link]" , ios::binary);
if(!f)
{
cout<<"\nError";
return;
}
[Link]((char*)&c , sizeof(c));
while(f)
{
if(strcmpi(name,[Link]())==0)
{
[Link]();
break;
}
[Link]((char*)&c , sizeof(c));
}
if([Link]())
{
cout<<"\nNot Found... Make Sure that You"<<"\nHave Entered Correct Customer Name!";
getch();
clrscr();
}
[Link]();
getch();
clrscr();
mainmenu();

//end of Query part

///////////////////////////////////////////////////////////////////////////

//For Terminating Program !

///////////////////////////////////////////////////////////////////////////

void border()
{
_setcursortype(_NOCURSOR);
int i,y=13,y1=13,a=179,b=196,c=218,d=192,e=217,f=191,l=176;

for(i=0;i<5;i++)
{
gotoxy(25,y);
cout<<char(a);
y++;
}

gotoxy(26,12);
for(i=0;i<30;i++)
cout<<char(b);

gotoxy(26,18);
for(i=0;i<30;i++)
cout<<char(b);
for(i=0;i<5;i++)
{
gotoxy(56,y1);
cout<<char(a);
y1++;
}

gotoxy(56,12);
cout<<char(f);

gotoxy(25,12);
cout<<char(c);

gotoxy(25,18);
cout<<char(d);

gotoxy(56,18);
cout<<char(e);

gotoxy(57,11);
cout<<char(f);

gotoxy(24,11);
cout<<char(c);

gotoxy(24,19);
cout<<char(d);

gotoxy(57,19);
cout<<char(e);

_setcursortype(_NORMALCURSOR);

void back()
{
_setcursortype(_NOCURSOR);

gotoxy(29,13);
cout<<"S";
delay(180);
cout<<"o";
delay(180);
cout<< "ft";
delay(180);
cout<<"wa";
delay(180);
cout<<"re ";
delay(700);
cout<<"Ter";
delay(180);
cout<<"mi";
delay(180);
cout<<"na";
delay(180);
cout<<"ti";
delay(180);
cout<<"ng";
delay(180);
cout<<".....";

gotoxy(1,24);
cout<<"TH";
delay(180);
cout<<"AN";
delay(180);
cout<<"K ";
delay(180);
cout<<"YOU !";
delay(180);
cout<<" FOR";
delay(700);
cout<<" USI";
delay(180);
cout<<"NG";
delay(180);
cout<<" OUR";
delay(180);
cout<<" SOF";
delay(180);
cout<<"TWARE !";
delay(500);
gotoxy(1,24);
for(int i=0;i<80;i++)
cout<<" ";
gotoxy(1,24);
cout<<"GO";
delay(180);
cout<<"OD";
delay(180);
cout<< " BY";
delay(180);
cout<<"E";
delay(180);
cout<<"..";
delay(180);
cout<<"..!";
_setcursortype(_NORMALCURSOR);

void load()
{
_setcursortype(_NOCURSOR);

int i,x,j,a;

gotoxy(28,16);
for(i=0;i<26;i++)
{
textcolor(YELLOW);
cprintf("°");
}

gotoxy(28,16);
for(i=0;i<26;i++)
{
textcolor(LIGHTGREEN);
cprintf("°");
delay(200);
}
_setcursortype(_NORMALCURSOR);
}

void makers()
{
int i,a,b,c,d;

textcolor(YELLOW);

gotoxy(1,1) ;
for(i=0;i<80;i++)
{
cprintf("*");
delay(80);
}

gotoxy(1,6);
for(i=0;i<80;i++)
{
cprintf("*");
delay(80);
}

gotoxy(20,3);
textcolor(LIGHTMAGENTA);
cprintf("A PROGRAM BY ASHWANI KUMAR & NITESH SALUJA");
}

void operate()
{
clrscr();
border();
makers();
back();
load();
delay(1000);
exit(0);

}
//////////////////////////////////////////////////////////////////////////

//confirm username & password ! HERE.

void border1()
{

_setcursortype(_NOCURSOR);

int i,y=8,y1=8,a=179,b=196,c=218,d=192,e=217,f=191,l=176;

for(i=0;i<5;i++)
{
gotoxy(25,y);
cout<<char(a);
y++;
}

gotoxy(26,7);
for(i=0;i<30;i++)
cout<<char(b);

gotoxy(26,13);
for(i=0;i<30;i++)
cout<<char(b);

for(i=0;i<5;i++)
{
gotoxy(56,y1);
cout<<char(a);
y1++;
}
gotoxy(56,7);
cout<<char(f);

gotoxy(25,7);
cout<<char(c);

gotoxy(25,13);
cout<<char(d);

gotoxy(56,13);
cout<<char(e);

gotoxy(57,6);
cout<<char(f);

gotoxy(24,6);
cout<<char(c);

gotoxy(24,14);
cout<<char(d);

gotoxy(57,14);
cout<<char(e);

_setcursortype(_NORMALCURSOR);

void con()
{

int c=1,f=1,i,t;
char unm[20],c1,p1[50];

gotoxy(1,1);
cout<<"\n\t\tWELCOME USER ! PLEASE INPUT CORRECT DETAILS HERE."<<"\n\tIF YOU ENTER
WRONG DETAILS THRICE, APPLICATION WILL TERMINATE !!" ;
while(f!=0 && c<4)
{
border1();
gotoxy(30,8);
cout<<"Username: ";
gets(unm);

gotoxy(30,9);
cout<<"Password: ";

i=0;
c1='\0';

_setcursortype(_NORMALCURSOR);

c1=getch();
while(c1!='\r')
{

if (c1=='\b'&& i!=0)
{ cout<<"\b \b";
i--; }

else if(c1!='\b')
{ cout<<"*";
p1[i++]=c1; }

c1=getch();

}
p1[i]='\0';

gotoxy(24,17);
cout<<"Please Press Any Key To Continue..";
getch();
clrscr();

_setcursortype(_NOCURSOR );

gotoxy(28,9);
cprintf("Checking The Data");
delay(1500);
cout<<"\a\a\a\a\a\a\a\a\a.";
delay(1500);
cout<<"\a\a\a\a\a\a\a\a\a.";
delay(1500);
cout<<"\a\a\a\a\a\a\a\a\a.";
delay(1500);
cout<<"\a\a\a\a\a\a\a\a\a.";
delay(1500);

if( (strcmp(unm,"admin")==0) && (strcmp(p1,"12345")==0) )


{
f=0; //correct username & password
clrscr();
gotoxy(28,12);
cout<<"Correct Data Entered !" ;
break;
}

if( (strcmp(unm,"admin")!=0) || (strcmp(p1,"12345")!=0) )


{
f=1; //incorrect username or password
c++;
clrscr();
gotoxy(24,12);
cout<<"\a\a"<<"Invalid Username Or Password !!";
delay(2030);
clrscr();

gotoxy(35,2);
cout<<"\a\aAttempt - "<<c;
}
_setcursortype( _NORMALCURSOR );
}

if(c>3)
{
clrscr();
gotoxy(31,11);
cout<<"\a\aNO CORRECT DATA FOUND !";

gotoxy(24,13);
cout<<"Now,Application is terminating...";
delay(800);
operate(); //function to abort the program
}

void login()
{

clrscr();
con();
getch();

void ash_nit()
{
textcolor(YELLOW);
gotoxy(1,24);
cprintf("CREATED");
delay(1000);
cprintf(" BY:");
delay(1000);
cprintf(" NITESH");
delay(1000);
cprintf(" &");
delay(1000);
cprintf(" ASHWANI");
delay(1200);
}

void ice() //for first loading part


{
_setcursortype(_NOCURSOR);
int i;
textcolor(LIGHTMAGENTA);
clrscr();
cout<<"\n\n\n\n\t\t WELCOME TO HOTEL ROOM RESERVATION SYSTEM";
cout<<"\n\n\n\n\t\t\t\tLOADING...";
for(i=0;i<=100;i++)
{
cout<<i<<"%";
delay(68);
gotoxy(43,9);
}

cout<<"\n\n\n\n";
textcolor(LIGHTRED);
for(i=0;i<80;i++)
{
cprintf("#");
delay(40);
}
gotoxy(1,3);

for(i=0;i<80;i++)
{
cprintf("#");
delay(40);
}
}

gotoxy(1,4);

for(i=0;i<9;i++)
{
cprintf("#");
cout<<endl;
delay(40);
}
}

int p=80,q=4;

for(i=0;i<9;i++)
{
gotoxy(p,q);
cprintf("#\n");
delay(40);
q++;
}

ash_nit();

cout<<"\n\n\n";
for(int n=0;n<14;n++)
{
textcolor(LIGHTCYAN);
for(i=0;i<3;i++)
{ gotoxy(35,20);
cprintf(". ");
delay(90);
gotoxy(37,20);
cprintf(". ");
delay(90);
gotoxy(39,20);
cprintf(". ");
delay(90);
gotoxy(41,20);
cprintf(". ");
delay(90);
gotoxy(43,20);
cprintf(". ");
delay(90);
gotoxy(45,20);
cprintf(". ");
delay(90);

textcolor(WHITE);
if(n>0 && n<6)
{
gotoxy(33,17);
cprintf("Initialising...");
}
if(n>6 && n<12)
{
gotoxy(33,17);
cprintf("Checking Files...");
}
if(n>12)
{
gotoxy(33,17);
cprintf("Please Wait ...");
delay(200);
}
textcolor(LIGHTCYAN);
gotoxy(35,20);
cout<<"*";
delay(90);
gotoxy(37,20);
cout<<"*";
delay(90);
gotoxy(39,20);
cout<<"*";
delay(90);
gotoxy(41,20);
cout<<"*";
delay(90);
gotoxy(43,20);
cout<<"*";
delay(90);
gotoxy(45,20);
cout<<"*";
delay(90);

_setcursortype(_NORMALCURSOR);
} //Initialise,Check gets finished HERE.

void loading()
{
clrscr();
ice();
gotoxy(28,23);
cout<<"Press any Key To Continue..!";
getch();
clrscr();
}

//first screen to display 'an'

void f5()
{
textcolor(LIGHTGRAY);
for(int j=0;j<2000;j++)
{
cprintf("*");
delay(5);
}
}

void f6()
{
int i,j,k=10,y=6,p=3 ,q=31 ;

textcolor(YELLOW);

gotoxy(19,6);
for(i=0;i<13;i++)
{
delay(100);
cprintf("@");
}

for(i=0;i<8;i++)
{
delay(100);
gotoxy(31,y);
cprintf("@");
y++;
}

for(i=0;i<11;i++)
{
delay(100);
gotoxy(q,10);
cprintf("@");
q--;
}

for(i=0;i<4;i++)
{
delay(100);
gotoxy(20,k);
cprintf("@");
k++;
}

gotoxy(20,14);
for(i=0;i<22;i++)
{
delay(100);
cprintf("@");
}

void f7()
{

int i,x,y=14,p=42,q=6,r=20;

for(i=0;i<8;i++)
{
delay(100);
gotoxy(42,y);
cprintf("@");
y--;
}

for(i=0;i<14;i++)
{
delay(100);
gotoxy(p,q);
cprintf("@");
p++;
q++;
}

for(i=0;i<20;i++)
{
delay(100);
gotoxy(56,r);
cprintf("@");
r--;
}

for(i=0;i<7;i++)
{
delay(100);
cprintf("@");
}
}

void creater()
{
textcolor(YELLOW);
gotoxy(24,22);
cprintf("A Ashwani");
delay(200);
cprintf(" & ");
delay(500);
cprintf("Nitesh");
delay(250);
cprintf(" Application !");
}

void symbol()
{
_setcursortype(_NOCURSOR);
clrscr();
f5();
f6();
f7();
creater();
_setcursortype(_NORMALCURSOR);
cout<<"\a\a\a\a";
delay(1000);
textcolor(YELLOW);
gotoxy(24,24);
cprintf("Press any Key To Continue....!");
getch();
clrscr();
}

/////////////////////////////////////////////////////////////////////////
// main() begins here.

void main()
{
clrscr();
window(1,1,80,50);
textbackground(LIGHTRED);
symbol();

loading();
login();
fun();
bar();

menu();
mainmenu(); // main screen/main menu called here.

getch();

}
// end of main()

 
Computer Science 
Project File 
 
 
of 
Ashwani Kumar Jha 
XIIth-A 
Board Roll No.  ___________ 
 
*******
Hotel Room Reservation 
System 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                                    //header file
#include<string.h> 
#include<process.h> 
#include<dos.h> 
#include<ctype.h> 
 
////////////////////////////////////////////
char rtype[20]; 
 
 
public: 
 
int rstatus;    //room no. & status 
int rno; 
long double rate; 
 
room() 
{ 
rstatus=0;
case 1:strcpy(rtype,"Single AC"); 
       rate=3000; 
       break; 
case 2:strcpy(rtype,"Single NonAC"); 
       rate=2000
rate=3000; 
       break; 
case 2:strcpy(rtype,"Single NonAC"); 
       rate=2000; 
       break; 
case 3:strcpy(rty
///////////////////////////////////////////////////// 
//cust class begins HERE. 
 
class cust{ 
 
char room_type
void showcust() 
{ 
clrscr(); 
 
 
cout<<"\n\nCustomer Name       :"; 
 
puts(cname); 
 
cout<<"\nCustomers phone number:
{ 
 
room r; 
ifstream f; 
unsigned long advance; 
int t,s; 
int flag; 
struct date d; 
cout<<"\n\nEnter The Type Of Suit C
break; 
} 
 
 
    f.open("Room.dat" , ios::binary); 
    if(!f) 
    { 
    cout<<"\n\t\t\tERROR !!"; 
    return 1;

You might also like