Você está na página 1de 12

#include<iostream.

h>
#include<fstream.h>
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<time.h>
#include<dos.h>
#include<ctype.h>
int trap=0;
char temp5[10];
char temp6[10];
typedef struct logindata
{
char username[10];
char password[10];
};
struct logindata l[6]={
{"Rohit","Rohit"},
{"Aman","Aman"},
{"Rishi","Rishi"},
{"Teacher","Teacher"},
{"Admin","12345"}
};

/**************************************************************************/
//Now these two variables contain username and password
//Now we have predefined 4 sets of usenames and passwords for our progam initially
//Now declaring the first Set of usenames and passwords

/
***********************************************************************************
/

//These were the perdefined passwods and user ids selected by this Software
//Now there is one master admin also declared..... he can add usenames and
passwods;
class room1
{
protected:
int r_no;
int r_charge;
char r_cust[20];
char c_city[20];
int c_mem;
char c_nat[20];
char r_avail;
int r_per;
int no;
char type[20];
int charge;
char cust[20];
char avail;
int per;
int year;
int mon;
int day;
public:
char r_type[20];
char getavail()
{
return(r_avail);
}
void getr1()
{

r_no=1;
strcpy(r_type,"Sp Dlx");
r_charge=1500;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name | Period |";
cout<<"\nno"<<"\t"<<r_type<<"\t:"<<r_charge<<"\t"<<r_avail;
}
void getr2()
{
r_no=2;
strcpy(r_type,"Dlx");
r_charge=1000;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name | Period |";
cout<<"\nno"<<"\t"<<r_type<<"\t:"<<r_charge<<"\t"<<r_avail;
}

void getr3()
{
r_no=3;
strcpy(r_type,"Gen");
r_charge=750;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name | Period |";
cout<<"\nno"<<"\t"<<r_type<<"\t:"<<r_charge<<"\t"<<r_avail;
}
void getr4()
{
r_no=4;
strcpy(r_type,"Coupl");
r_charge=1250;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name | Period |";
cout<<"\nno"<<"\t"<<r_type<<"\t:"<<r_charge<<"\t"<<r_avail;
}
void getr5()
{
r_no=5;
strcpy(r_type,"C Dlx");
r_charge=1500;
r_avail='Y';
strcpy(r_cust,"N.A");
r_per=0;
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name | Period |";
cout<<"\nno"<<"\t"<<r_type<<"\t:"<<r_charge<<"\t"<<r_avail;
}
void putinfo()
{

void modify()
{
cout<<"\n Enter modifyied data";
cout<<"\n__________________________________________________________________________
__";
cout<<"\n Enter Room no :";
cin>>no;
cout<<"\n Enter Room type :";
cin>>type;
cout<<"\n Enter Room charges :";
cin>>charge;
cout<<"\n Enter Room Availability :";
cin>>avail;
cout<<"\n Enter name of cust living :";
cin>>cust;
cout<<"\n For how many days cust want the room :";
cin>>per;
cout<<"\n...... Data is modified";
r_no=no;
strcpy(r_type,type);
r_charge=charge;
r_avail=avail;
strcpy(r_cust,cust);
r_per=per;
}
void allocate()
{
if(r_avail=='Y')
{
cout<<"\n Enter Name of cust living :";
cin >>cust;
cout<<"\n For how many days cust want the room :";
cin>>per;
cout<<"\n Enter city name :";
cin>>c_city;
cout<<"\n Enter nationality :";
cin>>c_nat;
cout<<"\n Enter no. of member in your group :";
cin>>c_mem;
cout<<"\n Enter the date of arrival ";
cout<<"\n------------------------------";
cout<<"\n Year : ";
cin >>year;
cout<<"\n Month :";
cin >>mon;
cout<<"\n Day :";
cin >>day;
strcpy(r_cust,cust);
cout<<"\n... Room is allocated to "<<r_cust;
r_per=per;
r_avail='N';
}
else
{
cout<<"\n ERROR : Room cannot be allocated ...";
cout<<"\n Room is not available...";
}
}
void putcust()
{
int q,j;
q=day+r_per;
j=strcmp(r_cust,"N.A");
if(j==0)
{
cout<<"\n Data not available ";
}
else
{
cout<<"\n Room No :"<<no<<"\n\n Customer Name :"<<cust<<"\n\n Days :"<<day<<"\n
City :"<<c_city<<"\n\n Nationality :"<<c_nat<<"\n\n No of member :"<<c_mem<<"\n
Arrival Date :"<<date(day,mon,year);
}
}
friend void date(int d,int m,int y);
};
void date(int d,int m,int y)
{
int p;
p=m%12;
if(p==0)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}

else
if(p==1)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}
else if(p==2)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;

else if(p==3)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}

else if(p==4)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}

else
if(p==5)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}

else
if(p==6)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}

else if(p==7)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}

else
if(p==8)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}
else
if(p==9)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}
else
if(p==10)
{
if(d>31)
{
d=d-31;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}

else
if(p==11)
{
if(d>30)
{
d=d-30;
m=m+1;
}
if(m>12)
{
m=m-12;
y=y+1;
}
cout<<"\n Departure Date :"<<d;cout<<"\t"<<m;cout<<"\t"<<y;
}

}
class bill: public room1
{

private:
long total;
int food;
long room;
float ser;
int t;
int oc;
public:

void calculate()
{
room= r_charge * r_per;
cout<<"\n Enter the bill amount of restaurant:";
cin>>food;
cout<<"\n Enter other charges:";
cin>>oc;
t=(int) (room + food + oc);
ser=(int)(0.05*t);
total=t+ser;
}

void dispbill()
{
clrscr();
cout<<"\n__________________________________________________________________________
______";
cout<<"\n************************* Hilton Hotel ***********************";
cout<<"\n -------------------------------- ";
cout<<"\n SECTOT 17,LINK Road,Dahisar(E),MOHALI-92. ";
cout<<"\n Tel :- 4545454 ";
cout<<"\n--------------------------------------------------------------------------
------";
cout<<"\n Customer name :\n "<r_cust;
/*4*/ cout<<"\n Stayed for "; cout<<"\n Room charges : "<<r_charge;
cout<<"\n Restaurant bill : "<<food;
cout<<"\n Other charges : "<<oc;
cout<<"\n Ser.tax % = 5%";
cout<<"\n Ser.tax ="<<t;
cout<<"\n Bill Amount >>>>>> Rs "<<total;
cout<<"\n ";
cout<<"\n THANK YOU !!!!!";
cout<<"\n Do Visit Us Again !";

strcpy(r_cust,"N.A");
r_per=0;
r_avail='Y';
day=0;
mon=0;
year=0;
strcpy(c_city,"N.A ");
strcpy(c_nat,"N.A ");
c_mem = 0;
}
void check();
};

void bill:: check()


{
if(r_avail=='Y')
{
cout<<"\n";
}
}

void main()
{
void login();
void coupd();
void coup();
void gen();
void dlx();
void spd();
ofstream fout;
fout.open("loginid.dat", ios::out | ios::binary);
//This statement opens the binary file

for(int s=0;s<=4;s++)
{
fout.write((char*) &l[s],sizeof(logindata));
// All four detaild get inserted into file

}
//Now authentication of the system begins
//l[6] is da given data supplied by the user
//let us declare another stucture variable for the above process
//let it be temp;
fout.close();
login();
ifstream fin;
fin.open("loginid.dat", ios::in | ios::binary |ios::app);
while((!fin.eof())&&(trap==0))
{ int i=0
//This is supposed to be done till the end of file is reached and trap is zero
fin.read((char*) &l[i], sizeof(logindata));
int z= strcmp(logindata[i].username,temp5);
if(z==0)//This means that they are equal i.e. strings match
{
int z2=strcmp(logindata[i].password,temp6);
if(z2==0)
{
trap=1;
}
}
i++;
}
fin.close();
if(trap==0)
{
cout<<"The entered usernames and passwords do not match ........please contact the
administrator";
getch();

}
int i,ch;
login();
/* time_t t
struct tm *str;
t=time(NULL);
str= localtime(&t));
cout<<"CURRENT TIME \n"<<str; */
bill R[5];
char c;
clrscr();
getch();
clrscr();

textcolor(4+200);
textbackground(1);
clrscr();

cout<<"\n--------------------------------------------------------------------------
------";
cout<<"\n--------------------------------------------------------------------------
------";
cout<<"\n*************************** WELCOME TO HOTEL Hilton
************************";
cout<<"\n--------------------------------------------------------------------------
------";
cout<<"\n--------------------------------------------------------------------------
------";
getch();

textcolor(10);
textbackground(4200);

xyz:
clrscr();
cout<<"\n--------------------------------------------------------------------------
------";
cout<<"\n********************** Hilton Hotel **************************";
cout<<"\n ________________________________ ";
cout<<"\n V.L.Mehta Road,Dahisar(E),Mumbai-68. ";
cout<<"\n Tel-45454545. ";
cout<<"\n--------------------------------------------------------------------------
------";
cout<<"\n ";
// cout<<"\n 0.TO LOGING YOUR ACCOUNT ";
cout<<"\n 1.GET INFORMATION 2.GET CUSTOMER INFO ";
cout<<"\n ";
cout<<"\n 3.MODIFY INFORMATION 4.CHECK THE AVAILABILITY ";
cout<<"\n ";
cout<<"\n 5.ALLOCATE ROOM 6.FEATURES OF ROOMS ";
cout<<"\n ";
cout<<"\n 7.CREATE BILL 8.EXIT ";
cout<<"\n\n Enter your choice : ";
cin >>ch;
fflush(stdin);
if(ch>8)
{
clrscr();
cout<<"\n Wrong choice ....";
getch();
goto xyz;
}

/* if(ch==0)
{
login();
}*/
else if(ch==1)
{

clrscr();

cout<<"\n ROOM INFO ";


cout<<"\n ----------- ";
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name | Period |";
R[0].getr1();
R[1].getr2();
R[2].getr3();
R[3].getr4();
R[4].getr5();
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------
------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
}
else
if(ch==2)
{
abc:
clrscr();
int n;
cout<<"\n Enter room no. :";
cin>>n;
if(n>5)
{
cout<<"\n Wrong choice ....";
getch();
goto abc;
}
n=n-1;
clrscr();
cout<<"\n CUSTOMER INFO ";
cout<<"\n -------------- ";
for(int i=0;i<5;i++)
{
R[i].putcust();
}
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------
------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
}
else
if(ch==3)
{
pqr:
clrscr();
int a;
cout<<"\n Enter Room no :";
cin>>a;
if(a>5)
{
cout<<"\n Wrong choice ...";
getch();
goto pqr;
}
a=a-1;
R[a].modify();
getch();
clrscr();
cout<<"\n ";
cout<<"\n--------------------------------------------------------------------------
------";
cout<<"\n Do you want to exit :";
cin>>c;
if (c=='N')
goto xyz;
else
goto mno;
}

else
if(ch==4)
{
clrscr();
cout<<"\n AVAILABLE ROOMS ";
cout<<"\n ----------------- ";
cout<<"\nRoom No| Type | Charge | Availability | Cust_Name | Period|";
for(i=0;i<=4;i++)
{
R[i].check();
}
getch();
&

Você também pode gostar