Sie sind auf Seite 1von 45

c code for hotel management system

#include<fstream.h>
#include<dos.h>
#include<ctype.h>
#include<iomanip.h>
#include<string.h>
#include<conio.h>
#include<stdio.h>
#include<process.h>
#include<graphics.h>
char pcustno[20];
char pbedtype[20];
char proomtype[20];
char proomno[20];
char parrdate[12];
char curdate[12];
int ptariff,daydiff;
char *toUpper(char *p)
{
for(int i=0;p[i]!='\0';i++)
{
if(p[i]>=97&&p[i]<=122)
p[i]=p[i]-32;
else
p[i]=p[i];
}
return p;
}
long toDays(long dd,long mm,long yy)
{
long Tday,i;
i = 1;
Tday = 0;
Tday = yy * 365;
i = 1;
while( i<mm)
{
if( i == 1 || i == 3 || i == 5 || i == 7 || i == 8 || i == 10 || i == 12 )
Tday = Tday + 31;
else if (i == 4 || i == 6 || i == 9 || i == 11)
Tday = Tday + 30;
else if( i == 2 )
{
if( yy % 4 == 0)
Tday = Tday + 29;
else
Tday = Tday + 28;
}
i = i + 1;
}
Tday = Tday + dd;
return Tday;
}
class room
{

public:
struct roomdata
{
char roomno[20];
char roomtype[20];
char bedtype[20];
char status[20];
}r;
void rcreate();
void rsearch();
void rupdate();
void rdelete();
int changestatus(char *);
int changevaccant(char *);
void rdisplay();
int getroomtype(char *);
void vreport();
void rdisplay_menu();
void oreport();
};
int room ::getroomtype(char *pr)
{
fstream f;
int flag=0;
f.open("room1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
while(1)
{
f.read((char *)&r,sizeof(r));
if(f.eof())break;
if(strcmp(toUpper(r.roomno),toUpper(pr))==0)
{
strcpy(proomtype,r.roomtype);
strcpy(pbedtype,r.bedtype);
flag=1;
break;
}
}
}
f.close();
if(flag==1)return 1;
else
return 0;
}

int room :: changestatus(char *proom)


{

fstream f3,f4;
f3.open("room1",ios::in);
f4.open("tmp",ios::out);
f3.seekg(0,ios::beg);
while(1)
{
f3.read((char *)&r,sizeof(r));
if(f3.eof())break;
if(strcmp(r.roomno,proom)==0)
{
strcpy(r.status,"occupied");
f4.write((char *)&r,sizeof(r));
}
else
f4.write((char *)&r,sizeof(r));
}
f3.close();
f4.close();
if(remove("room1")==0)
{
if(rename("tmp","room1")==0)return 1;
else
return 0;
}
else
return 0;
}
int room :: changevaccant(char *proom)
{
fstream f3,f4;
f3.open("room1",ios::in);
f4.open("tmp",ios::out);
f3.seekg(0,ios::beg);
while(1)
{
f3.read((char *)&r,sizeof(r));
if(f3.eof())break;
if(strcmp(r.roomno,proom)==0)
{
strcpy(r.status,"vaccant");
f4.write((char *)&r,sizeof(r));
}
else
f4.write((char *)&r,sizeof(r));
}
f3.close();
f4.close();
if(remove("room1")==0)
{
if(rename("tmp","room1")==0)return 1;
else
return 0;
}
else
return 0;
}

void room :: rcreate()


{
char ans;
char proomno[20];
int no;
fstream f1,f2;
do
{
f1.open("room1",ios::in);
f1.seekg(0,ios::end);
if(f1)
{
no=0;
f1.seekg(0,ios::beg);
//int ff;
while(1)
{
f1.read((char *)&r,sizeof(r));
if(f1.eof())break;
sscanf(r.roomno,"R-00%d",&no);
}
no=no+1;
f1.close();
}
else
no=1;
cout<<sprintf(r.roomno,"R-00%d",no);
cout<<"\n\t\t\tRoom No="<<r.roomno;
f1.close();
f2.close();
cout<<"\n\t\t\tEnter Room Type :";
fflush(stdin);
gets(r.roomtype);
cout<<"\n\t\t\tEnter Bed Type :";
fflush(stdin);
gets(r.bedtype);
strcpy(r.status,"vaccant");
f2.open("room1",ios::app);
f2.write((char *)&r,sizeof(r));
f2.close();
cout<<"\n\t\t\tDo You Want To Continue?..";
cin>>ans;
}while(ans=='y');
f1.close();
}
void room ::rsearch()
{
char proom[20];
fstream f;
f.open("room1",ios::in);

if(!f)
cout<<"\n\t\t\tFile Does not Exist";
else
{
cout<<"\n\t\t\tRoom Number To be Search:";
fflush(stdin);
gets(proom);
while(1)
{
f.read((char *)&r,sizeof(r));
if(f.eof())break;
if(strcmp(r.roomno,proom)==0)
{
cout<<endl<<"\n\t\t\tRoom type="<<r.roomtype;
cout<<endl<<"\n\t\t\tBed type="<<r.bedtype;
break;
}
}
if(f.eof())
cout<<"\n\t\t\tRoom/Bed Type Does Not exist";
cout<<"\n\n\t\t\tPress any key to continue........";
getche();
}
f.close();
}
void room ::rupdate()
{
char proom[20];
char btype[20];
char rtype[20];
fstream f,f1;
//tariff s;
f.open("room1",ios::in);
if(!f)
cout<<"\n\t\t\tFile Does not Exist";
else
{
while(1)
{
cout<<"\n\t\t\tRoom number To be Updated:";
fflush(stdin);
gets(proom);
f1.open("tmp",ios::out);
int ff=0;
f.seekg(0,ios::beg);
while(1)
{
f.read((char *)&r,sizeof(r));
if(f.eof())break;
if(strcmp(r.roomno,proom)==0)
{
cout<<"\n\t\t\tEnter Room Type=";
fflush(stdin);
gets(r.roomtype);
fflush(stdin);

cout<<"\n\t\t\tEnter Bed Type=";


fflush(stdin);
gets(r.bedtype);
f1.write((char *)&r,sizeof(r));
ff=1;
}
else
f1.write((char *)&r,sizeof(r));
}
f1.close();
if(ff==0)
{
cout<<"\n\t\t\tRoom/Bed Type Does Not exist";
char pp;
cout<<"\n\n\t\t\tDo you want to continue?";
cin>>pp;
if(pp!='y')break;
}
else
{
f.close();
f1.close();
if(remove("room1")==0)
if(rename("tmp","room1")==0)
cout<<"\n\t\t\tRecords Are Successfully Updated....";
cout<<"\n\n\t\t\tPress any key to continue...........";
getch();
break;
}
}
}
f.close();
}
void room ::rdelete()
{
char rno[20];
char ch;
fstream f,f1;
//tariff s;
f.open("room1",ios::in);
if(!f)
cout<<"\n\t\t\tFile Does not Exist";
else
{
f.close();
while(1)
{
f.open("room1",ios::in);
f.seekg(0,ios::beg);
cout<<"\n\t\t\tRoom number To be Deleted:";
fflush(stdin);
gets(rno);
f1.open("tmp",ios::out);
int ff=0;
while(1)
{
f.read((char *)&r,sizeof(r));
if(f.eof())break;

if(strcmp(r.roomno,rno)!=0)
f1.write((char *)&r,sizeof(r));
else
ff=1;
}
f1.close();
if(ff==0)
cout<<"\n\t\t\tRoom number Does Not exist";
else
cout<<"\n\t\t\tRecords Are Succesfully Deleted....";
f.close();
f1.close();
if(remove("room1")==0)
if(rename("tmp","room1")==0)
cout<<"\n\n\t\t\tDo you want to continue(y/n):";
ch=getche();
if(ch=='n')
break;
}
}
f.close();
f1.close();
}
void room ::rdisplay()
{
fstream f;
int i;
f.open("room1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
int no=1;
rdisplay_menu();
while(1)
{
f.read((char *)&r,sizeof(r));
if(f.eof())break;
cout<<endl<<setw(15)<<no<<setw(8)<<r.roomno<<setw(15)<<r
.roomtype<<setw(15)<<r.bedtype<<setw(15)<<r.status;
if(no%15==0)
{
cout<<"\nPress any key to contin
ue......";
getch();
clrscr();
rdisplay_menu();
}
no++;
}
if(no%15!=0)
{
for(i=1;i<80;i++)

{
gotoxy(i,no+5);
cout<<"-";
}
}
cout<<"\n\t"<<no-1<<" Records Are Displayed\n";
cout<<"Press any key to continue............";
getch();
}
f.close();
}
void room::rdisplay_menu()
{
int i;
cout<<"\n"<<setw(45)<<"ROOM REPORT";
cout<<"\n"<<setw(47)<<"*************\n";
cout<<"
Sno Room No
Room Type
Bed Type
Statu
s";
for(i=1;i<80;i++)
{
gotoxy(i,5);
cout<<"-";
}
}
void room ::vreport()
{
clrscr();
fstream f;
f.open("room1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
int no=1;
cout<<"\n"<<setw(45)<<"VACCANT ROOM REPORT";
cout<<"\n"<<setw(47)<<"*******************\n\n";
cout<<"
Sno Room No
Room Type
Bed Type
Status";
while(1)
{
f.read((char *)&r,sizeof(r));
if(f.eof())break;
if(strcmp(r.status,"vaccant")==0)
{
cout<<endl<<setw(15)<<no<<setw(8)<<r.roomno<<set
w(15)<<r.roomtype<<setw(15)<<r.bedtype<<setw(15)<<r.status;
if(no==20)
{
cout<<"\nPress any key to continue.
....";
getch();
}
no++;
}
}

cout<<"\n\t"<<no-1<<" Records Are Displayed\n";


cout<<"\nPress any key to continue.....";
getch();
}
f.close();
}
void room ::oreport()
{
clrscr();
fstream f;
int i;
f.open("room1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
int no=1;
cout<<"\n"<<setw(45)<<"OCCUPIED ROOM REPORT";
cout<<"\n"<<setw(47)<<"********************\n\n";
cout<<"
Sno
Room No
Room Type
Bed Type
Status";
while(1)
{
f.read((char *)&r,sizeof(r));
if(f.eof())break;
if(strcmp(r.status,"occupied")==0)
{
cout<<endl<<setw(15)<<no<<setw(11)<<r.roomno<<se
tw(13)<<r.roomtype<<setw(15)<<r.bedtype<<setw(15)<<r.status;
if(no==20)
{
cout<<"\nPress any key to contin
ue......";
getch();
}
no++;
}
}
cout<<"\n\n\t"<<no-1<<" Records Are Displayed\n";
cout<<"Press any key to continue...........";
getch();
}
f.close();
}

class tariff
{
public:
struct tariffdata

{
int price;
char roomtype[20];
char bedtype[20];
}s;
public:
void tcreate();
void tsearch();
void tupdate();
void tdelete();
void tdisplay();
int gettariff(char *,char *);
};
int tariff ::gettariff(char *pr,char *pb)
{
fstream f;
int flag=0;
f.open("abc1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
while(1)
{
f.read((char *)&s,sizeof(s));
if(f.eof())break;
if(strcmp(toUpper(s.roomtype),toUpper(pr))==0&&strcmp(to
Upper(s.bedtype),toUpper(pb))==0)
{
ptariff=s.price;
flag=1;
break;
}
}
}
f.close();
if(flag==1)return 1;
else
return 0;
}
void tariff :: tcreate()
{
int pprice;
char ans;
char rtype[15];
char btype[15];
fstream f1,f2;
do
{
while(1)
{

cout<<"\n\t\t\tEnter Room Type :";


fflush(stdin);
gets(rtype);
cout<<"\n\t\t\tEnter Bed Type :";
fflush(stdin);
gets(btype);
f1.open("abc1",ios::in);
if(f1)
{
while(1)
{
f1.read((char *)&s,sizeof(s));
if(f1.eof())break;
if(strcmp(s.roomtype,rtype)==0&&strcmp(s
.bedtype,btype)==0)break;
}
break;
}
else
break;
}
if(f1.eof())
{
f1.close();
f2.close();
strcpy(s.roomtype,rtype);
strcpy(s.bedtype,btype);
cout<<"\n\t\t\tEnter Price :";
cin>>s.price;
f2.open("abc1",ios::app);
f2.write((char *)&s,sizeof(s));
f2.close();
}
else
cout<<"\nRoom/Bed Type Already exist";
cout<<"\nDo You Want To Continue?..";
cin>>ans;
}while(ans=='y');
f1.close();
}

void tariff ::tsearch()


{
char rtype[20];
char btype[20];
fstream f;
//tariff s;
f.open("abc1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
cout<<"\n\t\t\tRoom Type to be search:";
fflush(stdin);
gets(rtype);
cout<<"\n\t\t\tBed Type to be search:";
fflush(stdin);

gets(btype);
while(1)
{
f.read((char *)&s,sizeof(s));
if(f.eof())break;
if(strcmp(s.roomtype,rtype)==0&&strcmp(s.bedtype,btype)=
=0)
{
cout<<endl<<"\t\t\tPrice="<<s.price;
break;
}
}
if(f.eof())
cout<<"\n\t\t\tRoom/Bed Type Does Not exist";
}
f.close();
cout<<"\n\n\t\t\tPress any key to continue........";
getch();
}
void tariff ::tupdate()
{
char rtype[20];
char btype[20];
fstream f,f1;
//tariff s;
f.open("abc1",ios::in);
if(!f)
cout<<"\nt\t\tFile Does not Exist";
else
{
while(1)
{
cout<<"\n\t\t\tRoom Type To be Updated:";
fflush(stdin);
gets(rtype);
cout<<"\n\t\t\tEnter Bed Type To Be Updated :";
fflush(stdin);
gets(btype);
f1.open("tmp",ios::out);
int ff=0;
f.seekg(0,ios::beg);
while(1)
{
f.read((char *)&s,sizeof(s));
if(f.eof())break;
if(strcmp(s.roomtype,rtype)==0&&strcmp(s.bedtype,btype)=
=0)
{
cout<<"\n\t\t\tEnter New Price=";
fflush(stdin);
cin>>s.price;
f1.write((char *)&s,sizeof(s));
ff=1;
}
else

f1.write((char *)&s,sizeof(s));
}
f1.close();
if(ff==0)
{
cout<<"\n\t\t\tRoom/Bed Type Does Not exist";
break;
}
else
{
cout<<"\n\t\t\tRecords Are Successfully Updated....";
break;
}
}
f.close();
f1.close();
if(remove("abc1")==0)
if(rename("tmp","abc1")==0)
cout<<"\n\n\t\t\tPress any key to continue.......";
getch();
}
f.close();
}
void tariff ::tdelete()
{
char rtype[20];
char btype[20];
char ch;
fstream f,f1;
//tariff s;
f.open("abc1",ios::in);
if(!f)
cout<<"\n\t\t\tFile Does not Exist";
else
{
f.close();
while(1)
{
f.open("abc1",ios::in);
f.seekg(0,ios::beg);
cout<<"\n\t\t\tRoom Type To be Deleted:";
fflush(stdin);
gets(rtype);
cout<<"\n\t\t\tBed Type To Be Deleted :";
fflush(stdin);
gets(btype);
f1.open("tmp",ios::out);
int ff=0;
while(1)
{
f.read((char *)&s,sizeof(s));
if(f.eof())break;
if(strcmp(s.roomtype,rtype)!=0 || strcmp(s.bedtype,btype
)!=0)
f1.write((char *)&s,sizeof(s));
else
ff=1;

}
f1.close();
if(ff==0)
cout<<"\n\t\t\tRoom/Bed Type Does Not exist";
else
cout<<"\n\t\t\tRecords Are Succesfully Deleted....";
f.close();
f1.close();
if(remove("abc1")==0)
if(rename("tmp","abc1")==0)
cout<<"\n\n\t\t\tDo you want to continue(y/n):";
ch=getche();
if(ch=='n')
break;
}
}
f.close();
f1.close();
}

void tariff ::tdisplay()


{
fstream f;
int row,col,no;
f.open("abc1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
clrscr();
no=1;
gotoxy(30,3);
cout<<"TARIFF REPORT";
gotoxy(30,4);
cout<<"*************";
row=16;
gotoxy(row,6);
cout<<"Sno";
row=row+6;
gotoxy(row,6);
cout<<"Room Type";
row=row+20;
gotoxy(row,6);
cout<<"Bed Type";
row=row+10;
gotoxy(row,6);
cout<<"Tariff";
col=7;
while(1)
{
f.read((char *)&s,sizeof(s));
if(f.eof())break;

row=16;
gotoxy(row,col);
cout<<no;
row=row+6;
gotoxy(row,col);
cout<<s.roomtype;
row=row+20;
gotoxy(row,col);
cout<<s.bedtype;
row=row+10;
gotoxy(row,col);
cout<<s.price;
no++;
col=col+1;
}
}
row=20;
gotoxy(row,col);
cout<<"\n\t"<<no-1<<" Records Are Displayed\n";
cout<<"Press any key to continue............";
getch();
}
class customer
{
public:
struct custdata
{
char custno[20];
char roomno[20];
char name[20];
char address[30];
char nationality[30];
char sex[30];
int age;
char destination_from[20];
int occupancy;
char arr_date[12];
char dep_date[12];
char status[20];
}c;
void ccreate();
void csearch();
void cupdate();
void cdelete();
void cdisplay();
int getroll(char *);
int changestatus(char *);
void preport();
void areport();
void cheading(int);
void cdisplay_menu();
};
int customer ::getroll(char *pc)
{

fstream f;
int flag=0;
f.open("cust1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
while(1)
{
f.read((char *)&c,sizeof(c));
if(f.eof())break;
if(strcmp(toUpper(c.custno),toUpper(pc))==0)
{
strcpy(proomno,c.roomno);
strcpy(parrdate,c.arr_date);
flag=1;
break;
}
}
}
f.close();
if(flag==1)return 1;
else
return 0;
}
int customer :: changestatus(char *proom)
{
fstream f3,f4;
f3.open("cust1",ios::in);
f4.open("tmp",ios::out);
f3.seekg(0,ios::beg);
while(1)
{
f3.read((char *)&c,sizeof(c));
if(f3.eof())break;
if(strcmp(c.custno,proom)==0)
{
strcpy(c.status,"absent");
f4.write((char *)&c,sizeof(c));
}
else
f4.write((char *)&c,sizeof(c));
}
f3.close();
f4.close();
if(remove("cust1")==0)
{
if(rename("tmp","cust1")==0)return 1;
else
return 0;
}
else
return 0;
}

void customer :: ccreate()


{
char ans;
int no;
fstream f1,f2;
do
{
f1.open("cust1",ios::in);
f1.seekg(0,ios::end);
if(f1)
{
no=0;
f1.seekg(0,ios::beg);
while(1)
{
f1.read((char *)&c,sizeof(c));
if(f1.eof())break;
sscanf(c.custno,"C-00%d",&no);
}
no=no+1;
f1.close();
}
else
no=1;
sprintf(c.custno,"C-00%d",no);
cout<<"\nCust No="<<c.custno;
f1.close();
f2.close();
cout<<"\nEnter Room no :";
fflush(stdin);
gets(c.roomno);
cout<<"\nEnter Customer Name :";
fflush(stdin);
gets(c.name);
cout<<"\nEnter Customer Address:";
fflush(stdin);
gets(c.address);
cout<<"\nEnter Customer Nationlity:";
fflush(stdin);
gets(c.nationality);
cout<<"\nEnter Customer Age:";
fflush(stdin);
cin>>c.age;
cout<<"\nEnter Customer Sex:";
fflush(stdin);
gets(c.sex);
cout<<"\nEnter Customer Destination Address:";
fflush(stdin);
gets(c.destination_from);
cout<<"\nEnter Customer Arriving Date(dd\mm\yyyy):";
fflush(stdin);

gets(c.arr_date);
cout<<"\nEnter Customer Departure Date(dd\mm\yyyy):";
fflush(stdin);
gets(c.dep_date);
strcpy(c.status,"present");
f2.open("cust1",ios::app);
f2.write((char *)&c,sizeof(c));
room rr;
if(rr.changestatus(c.roomno)==1)
cout<<"\n\t\t\tRecords Are Registered.....";
f2.close();
cout<<"\nDo You Want To Continue?..";
cin>>ans;
}while(ans=='y');
f1.close();
}

void customer ::csearch()


{
char croom[20];
fstream f;
f.open("cust1",ios::in);
if(!f)
cout<<"\n\t\t\tFile Does not Exist";
else
{
cout<<"\n\n\t\tCustomer Number To be Search:";
fflush(stdin);
gets(croom);
while(1)
{
f.read((char *)&c,sizeof(c));
if(f.eof())break;
if(strcmp(c.custno,croom)==0)
{
cout<<endl<<"\n\t\t\tCustomer Name="<<c.name;
cout<<"\n\n\t\t\tRoom no :"<<c.roomno;
cout<<endl<<"\n\t\t\tCustomer Address="<<c.address;
cout<<endl<<"\n\t\t\tCustomer Age="<<c.age;
cout<<endl<<"\n\t\t\tCustomer Sex="<<c.sex;
cout<<endl<<"\n\t\t\tCustomer Nationality="<<c.nationali
ty;
cout<<"\n\n\t\t\tCustomer Arriving Date:"<<c.arr_date;
cout<<"\n\n\t\t\tCustomer Departure Date:"<<c.dep_date;
break;
}
}
if(f.eof())
cout<<"\n\t\tCustomer Number Does Not exist";
cout<<"\n\n\t\t\tPress any key to continue......";
getch();
}
f.close();
}

void customer ::cupdate()


{
char croom[20];
char btype[20];
char rtype[20];
fstream f,f1;
f.open("cust1",ios::in);
if(!f)
cout<<"\n\t\t\tFile Does not Exist";
else
{
while(1)
{
cout<<"\n\t\t\tCustomer number To be Updated:";
fflush(stdin);
gets(croom);
f1.open("tmp",ios::out);
int ff=0;
f.seekg(0,ios::beg);
while(1)
{
f.read((char *)&c,sizeof(c));
if(f.eof())break;
if(strcmp(c.custno,croom)==0)
{
cout<<"\n\t\t\tEnter New Customer Name=";
fflush(stdin);
gets(c.name);
cout<<"\n\t\t\tEnter New Address=";
fflush(stdin);
gets(c.address);
cout<<"\n\t\t\tEnter New Age=";
fflush(stdin);
cin>>c.age;
cout<<"\n\t\t\tEnter New Sex=";
fflush(stdin);
gets(c.sex);
cout<<"\n\t\t\tEnter New Nationality=";
fflush(stdin);
gets(c.nationality);
cout<<"\n\t\t\tEnter New Destination Addresse=";
fflush(stdin);
gets(c.destination_from);
/*cout<<"\n\t\t\tEnter New Occupancy=";
cin>>c.occupancy;*/
cout<<"\n\t\t\tEnter Customer New Arriving Date=";
fflush(stdin);
gets(c.arr_date);
cout<<"\n\t\t\tEnter Customer New Departure Date=";
fflush(stdin);
gets(c.dep_date);
f1.write((char *)&c,sizeof(c));
ff=1;
}
else
f1.write((char *)&c,sizeof(c));
}

f1.close();
if(ff==0)
{
cout<<"\n\t\t\tCustomer No. Does Not exist";
char pp;
cout<<"\n\t\t\tDo you want to continue?";
cin>>pp;
if(pp!='y')break;
}
else
{
f.close();
f1.close();
if(remove("cust1")==0)
if(rename("tmp","cust1")==0)
cout<<"\n\t\t\tRecords Are Successfully Updated....";
cout<<"\n\t\t\tPress any key to continue.........";
getch();
break;
}
}
}
f.close();
}
void customer ::cdelete()
{
char croom[20];
fstream f;
f.open("cust1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
char ans;
cout<<"\nAre you sure want to delete all records?";
cin>>ans;
if(ans=='y')
{
f.close();
if(remove("cust1")==0)cout<<"\n\t\tRecords are Successfully Dele
ted.";
}
}
f.close();
}

void customer ::cdisplay()


{
fstream f;
f.open("cust1",ios::in);
if(!f)
{
cout<<"\nFile Does not Exist";
cout<<"\nPress any key to continue......";

getch();
}
else
{
clrscr();
int i,row,no=1;
cdisplay_menu();
int col=8;
while(1)
{
f.read((char *)&c,sizeof(c));
if(f.eof())break;
int row=2;
gotoxy(row,col);
cout<<no;
row=row+6;
gotoxy(row,col);
cout<<c.custno;
row=row+10;
gotoxy(row,col);
cout<<c.roomno;
row=row+10;
gotoxy(row,col);
cout<<c.name;
row=row+10;
gotoxy(row,col);
cout<<c.address;
row=row+12;
gotoxy(row,col);
cout<<c.arr_date;
row=row+12;
gotoxy(row,col);
cout<<c.dep_date;
row=row+12;
gotoxy(row,col);
cout<<c.status;
if(no%15==0)
{
cout<<"\nPress any key to contin
ue......";
getch();
clrscr();
cdisplay_menu();
col=8;
}
no++;
col=col+1;
}
row=20;
gotoxy(row,col);
if(no%15!=0)
{
for(i=1;i<80;i++)
{
gotoxy(i,col);
cout<<"-";
}
}
cout<<"\n\t"<<no-1<<" Records Are Displayed\n";

cout<<"Press any key to continue............";


getch();
}
f.close();

}
void customer::cdisplay_menu()
{
int row,i;
gotoxy(30,3);
cout<<"CUSTOMER REPORT";
gotoxy(30,4);
cout<<"***************";
row=2;
gotoxy(row,6);
cout<<"Sno";
row=row+6;
gotoxy(row,6);
cout<<"Cust No";
row=row+10;
gotoxy(row,6);
cout<<"Room No";
row=row+10;
gotoxy(row,6);
cout<<"Name";
row=row+10;
gotoxy(row,6);
cout<<"Address";
row=row+12;
gotoxy(row,6);
cout<<"Arr. Date";
row=row+12;
gotoxy(row,6);
cout<<"Dep. Date";
row=row+12;
gotoxy(row,6);
cout<<"Status";
for(i=1;i<80;i++)
{
gotoxy(i,7);
cout<<"-";
}
}
void customer::cheading(int j)
{
int row,i;
gotoxy(30,3);
if(j==1)
cout<<"PRESENT CUSTOMER REPORT";
else
cout<<"ABSENT CUSTOMER REPORT";
gotoxy(30,4);
cout<<"***********************";
row=2;
gotoxy(row,6);
cout<<"Sno";
row=row+6;

gotoxy(row,6);
cout<<"Cust No";
row=row+10;
gotoxy(row,6);
cout<<"Room No";
row=row+10;
gotoxy(row,6);
cout<<"Name";
row=row+10;
gotoxy(row,6);
cout<<"Address";
row=row+12;
gotoxy(row,6);
cout<<"Arr. Date";
row=row+12;
gotoxy(row,6);
cout<<"Dep. Date";
row=row+12;
gotoxy(row,6);
cout<<"Status";
for(i=1;i<80;i++)
{
gotoxy(i,7);
cout<<"-";
}
}
void customer ::preport()
{
fstream f;
int i,row;
f.open("cust1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
clrscr();
int no=1;
cheading(1);
int col=8;
while(1)
{
f.read((char *)&c,sizeof(c));
if(f.eof())break;
if(strcmp(c.status,"present")==0)
{
row=2;
gotoxy(row,col);
cout<<no;
row=row+6;
gotoxy(row,col);
cout<<c.custno;
row=row+10;
gotoxy(row,col);
cout<<c.roomno;
row=row+10;
gotoxy(row,col);
cout<<c.name;
row=row+10;

gotoxy(row,col);
cout<<c.address;
row=row+12;
gotoxy(row,col);
cout<<c.arr_date;
row=row+12;
gotoxy(row,col);
cout<<c.dep_date;
row=row+12;
gotoxy(row,col);
cout<<c.status;
if(no%15==0)
{
cout<<"\nPress any key to contin
ue......";
getch();
clrscr();
cheading(1);
col=8;
}
no++;
col=col+1;
}
}
row=20;
gotoxy(row,col);
if(no%15!=0)
{
for(i=1;i<80;i++)
{
gotoxy(i,col);
cout<<"-";
}
}
cout<<"\n\t"<<no-1<<" Records Are Displayed\n";
cout<<"Press any key to continue............";
getch();
}
f.close();
}
void customer ::areport()
{
fstream f;
int row,i;
f.open("cust1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
clrscr();
int no=1;
cheading(2);
int col=8;
while(1)

{
f.read((char *)&c,sizeof(c));
if(f.eof())break;
if(strcmp(c.status,"absent")==0)
{
row=2;
gotoxy(row,col);
cout<<no;
row=row+6;
gotoxy(row,col);
cout<<c.custno;
row=row+10;
gotoxy(row,col);
cout<<c.roomno;
row=row+10;
gotoxy(row,col);
cout<<c.name;
row=row+10;
gotoxy(row,col);
cout<<c.address;
row=row+12;
gotoxy(row,col);
cout<<c.arr_date;
row=row+12;
gotoxy(row,col);
cout<<c.dep_date;
row=row+12;
gotoxy(row,col);
cout<<c.status;
if(no%15==0)
{
cout<<"\nPress any key to contin
ue......";
getch();
clrscr();
cheading(2);
col=8;
}
no++;
col=col+1;
}
}
row=20;
gotoxy(row,col);
if(no%15!=0)
{
for(i=1;i<80;i++)
{
gotoxy(i,col);
cout<<"-";
}
}
cout<<"\n\t"<<no-1<<" Records Are Displayed\n";
cout<<"Press any key to continue............";
getch();
}
f.close();

}
class bill
{
public:
struct billdata
{
char billno[20];
char custno[20];
char bill_date[12];
int days;
int tariff;
int amount;
void
void
void
void
void
void
void
void
void

}b;
bcreate();
bsearch();
bdelete();
bdisplay();
dailyreport();
heading(int);
monthlyreport();
writeString(int,int,int);
bdisplay_menu();

};
void bill :: writeString(int dd2,int mm2,int yy2)
{
char date1[12];
sprintf(date1,"%2d/%2d/%4d",dd2,mm2,yy2);
strcpy(curdate,date1);

}
void bill :: bcreate()
{
char ans;
int no;
int dd1=0,dd2=0,mm1=0,mm2=0,yy1=0,yy2=0;
long dt1,dt2;
fstream f1,f2;
do
{
f1.open("bill1",ios::in);
f1.seekg(0,ios::end);
if(f1)
{
no=0;
f1.seekg(0,ios::beg);
while(1)
{
f1.read((char *)&b,sizeof(b));
if(f1.eof())break;

sscanf(b.billno,"B-00%d",&no);
}
no=no+1;
f1.close();
}
else
no=1;
f1.close();
sprintf(b.billno,"B-00%d",no);
cout<<"\n\t\t\tBill No.="<<b.billno;
f1.close();
//f2.close();
char aa;
while(1)
{
cout<<"\n\t\t\tEnter Customer Number :";
fflush(stdin);
gets(b.custno);
customer c1;
room r1;
tariff t1;
if(c1.getroll(b.custno)==1)
{
if(sscanf(parrdate,"%2d/%2d/%4d",&dd1,&mm1,&yy1)
!=0)
{
dt1=toDays(dd1,mm1,yy1);
}
if(r1.getroomtype(proomno)==1)
{
if(t1.gettariff(proomtype,pbedtype)==1)
{
struct date d;
char date1[12];
getdate(&d);
yy2=d.da_year;
dd2=d.da_day;
mm2= d.da_mon;
bill bb;
bb.writeString(dd2,mm2,yy2);
strcpy(b.bill_date,curdate);
dt2=toDays(dd2,mm2,yy2);
long days=dt2-dt1;
b.days=days;
b.tariff=ptariff;
b.amount=ptariff*days;
f2.open("bill1",ios::app);
f2.write((char *)&b,sizeof(b));
f2.close();
room rr1;
customer cc1;
if(rr1.changevaccant(proomno)==1
)
{
if(cc1.changestatus(b.custno)==1)
{

cout<<"\n\t\t\tInvoice C
reated...";
}
}

break;
}
}
}
else
{
cout<<"\n\t\t\tParent key not found";
cout<<"\n\t\t\tWish to continue?";
cin>>aa;
if(aa!='y')break;
}
}

cout<<"\n\t\t\tDo You Want To Continue?..";


cin>>ans;
}while(ans=='y');
}

void bill ::bsearch()


{
char croom[20];
fstream f;
f.open("bill1",ios::in);
if(!f)
cout<<"\n\t\t\tFile Does not Exist";
else
{
cout<<"\n\t\t\tBill Number To be Search:";
fflush(stdin);
gets(croom);
while(1)
{
f.read((char *)&b,sizeof(b));
if(f.eof())break;
if(strcmp(b.billno,croom)==0)
{
cout<<endl<<"\t\t\tCustomer No="<<b.custno;
cout<<endl<<"\n\t\t\tNo Of. Days="<<b.days;
cout<<endl<<"\n\t\t\tTotal Amount="<<b.amount;
cout<<endl<<"\n\t\t\tBill Date="<<b.bill_date;
break;
}
}
if(f.eof())

cout<<"\n\t\t\tCustomer Number Does Not exist";


cout<<"\n\t\t\tPress any key to continue......";
getch();
}
f.close();
}
void bill ::bdelete()
{
char croom[20];
fstream f;
f.open("bill1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
char ans;
cout<<"\n\t\tAre you sure want to delete all records?";
cin>>ans;
if(ans=='y')
{
f.close();
if(remove("bill1")==0)
cout<<"\n\t\tRecords are Successfully Deleted.";
}
}
f.close();
}
void bill ::bdisplay()
{
fstream f;
f.open("bill1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
clrscr();
int row,no=1,i;
bdisplay_menu();
int col=8;
while(1)
{
f.read((char *)&b,sizeof(b));
if(f.eof())break;
row=2;
gotoxy(row,col);
cout<<no;
row=row+6;
gotoxy(row,col);
cout<<b.billno;
row=row+10;
gotoxy(row,col);
cout<<b.custno;
row=row+10;
gotoxy(row,col);

cout<<b.days;
row=row+10;
gotoxy(row,col);
cout<<b.tariff;
row=row+12;
gotoxy(row,col);
cout<<b.amount;
row=row+12;
gotoxy(row,col);
cout<<b.bill_date;
if(no%15==0)
{
cout<<"\nPress any key to contin
ue......";
getch();
clrscr();
bdisplay_menu();
col=8;
}
no++;
col=col+1;
}
row=20;
gotoxy(row,col);
if(no%15!=0)
{
for(i=1;i<80;i++)
{
gotoxy(i,col);
cout<<"-";
}
}
cout<<"\n\t"<<no-1<<" Records Are Displayed\n";
cout<<"Press any key to continue...........";
getch();
}
f.close();

}
void bill::bdisplay_menu()
{
int i;
gotoxy(30,3);
cout<<"BILLING REPORT";
gotoxy(30,4);
cout<<"**************";
int row=2;
gotoxy(row,6);
cout<<"Sno";
row=row+6;
gotoxy(row,6);
cout<<"Bill No";
row=row+10;
gotoxy(row,6);
cout<<"Cust. No";

row=row+10;
gotoxy(row,6);
cout<<"No Of. Days";
row=row+10;
gotoxy(row,6);
cout<<"Tariff";
row=row+12;
gotoxy(row,6);
cout<<"Amount";
row=row+12;
gotoxy(row,6);
cout<<"Bill Date";
for(i=1;i<80;i++)
{
gotoxy(i,7);
cout<<"-";
}
}
void bill ::dailyreport()
{
clrscr();
int row,i;
fstream f;
char pdate[12];
long d1,d2=0;
int dd1,dd2,mm1,mm2,yy1,yy2;
f.open("bill1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
gotoxy(10,1);
cout<<"Enter Date In DD/MM/YYYY Format :";
cin>>pdate;
sscanf(pdate,"%2d/%2d/%4d",&dd1,&mm1,&yy1);
int rec=0;
d1=toDays(dd1,mm1,yy1);
f.seekg(0,ios::beg);
while(1)
{
f.read((char *)&b,sizeof(b));
if(f.eof())break;
sscanf(b.bill_date,"%2d/%2d/%4d",&dd2,&mm2,&yy2);
d2=toDays(dd2,mm2,yy2);
if(d1==d2)rec++;
}
f.close();
gotoxy(30,10);
if(rec>0)
{
int no=1;
heading(1);
int col=8;
int ta=0;
f.open("bill1",ios::in);
while(1)

{
f.read((char *)&b,sizeof(b));
if(f.eof())break;
sscanf(b.bill_date,"%2d/%2d/%4d",&dd2,&mm2,&yy2);
d2=toDays(dd2,mm2,yy2);
gotoxy(30,11);
if(d1==d2)
{
row=2;
gotoxy(row,col);
cout<<no;
row=row+6;
gotoxy(row,col);
cout<<b.billno;
row=row+10;
gotoxy(row,col);
cout<<b.custno;
row=row+10;
gotoxy(row,col);
cout<<b.days;
row=row+10;
gotoxy(row,col);
cout<<b.tariff;
row=row+12;
gotoxy(row,col);
cout<<b.amount;
ta=ta+b.amount;
row=row+12;
gotoxy(row,col);
cout<<b.bill_date;
no++;
col=col+1;
if(no%15==0)
{
cout<<"\nPress any key to contin
ue......";
getch();
clrscr();
heading(1);
col=8;
}
}
}
for(i=1;i<73;i++)
{
gotoxy(i,col);
cout<<"-";
}
col++;
gotoxy(37,col);
cout<<"Total Amount="<<ta;
col++;
for(i=1;i<73;i++)
{
gotoxy(i,col);
cout<<"-";
}

row=5;
col++;
gotoxy(row,col);
cout<<"\t"<<no-1<<" Records Are Displayed\n";
cout<<"\nPress any key to continue......";
getch();
}
else
{
cout<<"\nRecords Not Found";
cout<<"\nPress any key to continue......";
getch();
}
}
f.close();

char month[12][20]={
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December"
};
void bill ::monthlyreport()
{
clrscr();
int row,i;
fstream f;
char pmonth[16];
//long d1,d2=0;
int dd1,dd2,mm1,mm2,yy1,yy2,year,kk=0;
f.open("bill1",ios::in);
if(!f)
cout<<"\nFile Does not Exist";
else
{
gotoxy(10,1);
cout<<"Enter Month In Character:";
cin>>pmonth;
int flag=0;
int j;
for(j=0;j<12;j++)
{
if(strcmp(toUpper(month[j]),toUpper(pmonth))==0)
{

kk=j;
flag=1;
}
}
if(flag==1)
{
mm1=kk+1;
gotoxy(10,2);
cout<<" Enter Year In Digit";
cin>>year;
int rec=0;
f.seekg(0,ios::beg);
while(1)
{
f.read((char *)&b,sizeof(b));
if(f.eof())break;
sscanf(b.bill_date,"%2d/%2d/%4d",&dd2,&mm2,&yy2);
if(mm1==mm2&&year==yy2)
rec++;
}
f.close();
gotoxy(30,10);
if(rec>0)
{
int no=1;
heading(2);
int col=8;
int ta=0;
f.open("bill1",ios::in);
while(1)
{
f.read((char *)&b,sizeof(b));
if(f.eof())break;
sscanf(b.bill_date,"%2d/%2d/%4d",&dd2,&mm2,&yy2);
if(mm1==mm2&&year==yy2)
{
row=2;
gotoxy(row,col);
cout<<no;
row=row+6;
gotoxy(row,col);
cout<<b.billno;
row=row+10;
gotoxy(row,col);
cout<<b.custno;
row=row+10;
gotoxy(row,col);
cout<<b.days;
row=row+10;
gotoxy(row,col);
cout<<b.tariff;
row=row+12;
gotoxy(row,col);
cout<<b.amount;
ta=ta+b.amount;
row=row+12;
gotoxy(row,col);

cout<<b.bill_date;
no++;
col=col+1;
if(no%15==0)
{
cout<<"\nPress any key to continue......";
getch();
clrscr();
heading(2);
col=8;
}
}
}
for(i=1;i<73;i++)
{
gotoxy(i,col);
cout<<"-";
}
col++;
gotoxy(37,col);
cout<<"Total Amount="<<ta;
col++;
for(i=1;i<73;i++)
{
gotoxy(i,col);
cout<<"-";
}
row=5;
col++;
gotoxy(row,col);
cout<<"\n"<<no-1<<" Records Are Displayed\n";
cout<<"\nPress any key to continue.........";
getch();
}
else
{
cout<<"\nPress any key to continue......";
getch();
cout<<"Records Not Found";
}
}
else
{
cout<<"\nInvalid Month";
cout<<"\nPress any key to continue......";
getch();
}
}
f.close();

}
void bill::heading(int i)
{
gotoxy(30,4);
if(i==2)
cout<<"MONTHLY BILLING REPORT";

else
cout<<"DAILY BILLING REPORT";
gotoxy(30,5);
cout<<"**********************";
int row=2;
gotoxy(row,6);
cout<<"Sno";
row=row+6;
gotoxy(row,6);
cout<<"Bill_no";
row=row+10;
gotoxy(row,6);
cout<<"Cust_no";
row=row+10;
gotoxy(row,6);
cout<<"No_of_days";
row=row+10;
gotoxy(row,6);
cout<<"Tariff";
row=row+12;
gotoxy(row,6);
cout<<"Amount";
row=row+12;
gotoxy(row,6);
cout<<"Bill_date";
int j;
for(j=1;j<73;j++)
{
gotoxy(j,7);
cout<<"-";
}
}
void MAIN_SCREEN();
void Tariff_Menu(void);
void Room_Menu(void);
void Room_Booking(void);
void Bill_Menu(void);
void Report(void);
void Room_Report(void);
void Customer_Report(void);
void Bill_Report(void);
void Start(void);
void End(void);
void main()
{
MAIN_SCREEN();
End();
}
void MAIN_SCREEN(void)
{
char ch;
/* request auto detection of graph driver*/
int gd = DETECT,gm,errorcode;
char pass[]="shiv";
char tmp[20];
int i=0;
clrscr();
gotoxy(30,10);
cout<<"Enter Your Password :";

while(1)
{
char ch=getch();
putch('*');
if(ch==13)break;
tmp[i++]=ch;
}
tmp[i]='\0';
if(strcmp(tmp,pass)==0)
{
Start();
clrscr();
while (ch < '6')
{
// Initializes the graphics system
initgraph(&gd, &gm,"C:\\TC\\BGI");
// setbkcolor sets the current background color using the palett
e
setbkcolor(10);
// setcolor sets the current drawing color
setcolor(BLUE);
// Sets the current text characteristics
settextstyle(0,HORIZ_DIR,1);
// Changes the text style (font)
// outtextxy displays a string at the specified location (graphi
cs mode)
outtextxy(20,30," <6> = Exit"); // To display a text in a partic
ular row and coloumn position
setcolor(BLUE);
settextstyle(10,HORIZ_DIR,1);
// outtextxy displays a string at the specified location (graphi
cs mode)
outtextxy(250,75," MAIN MENU");
rectangle(160,130,500,277);
settextstyle(8,HORIZ_DIR,1);
setcolor(RED);
outtextxy(190,140, "1. Tariff Menu");
outtextxy(190,160, "2. Room Menu");
outtextxy(190,180,"3. Room Booking");
outtextxy(190,200, "4. Bill Menu");
outtextxy(190,220, "5. Report");
outtextxy(190,240, "6. Enter 6 for Exit");
outtextxy(200,280,"Enter Your Choice(1-6) ");
ch = getche();
closegraph();
switch (ch)
{
case '6':
{
clrscr();
break;
}
case '1':
{

Tariff_Menu();
break;
}
case '2':
{
Room_Menu();
break;
}
case '3':
{
Room_Booking();
break;
}
case '4':
{
Bill_Menu();
break;
}
case '5':
{
Report();
break;
}
}
}
for (int i = 25; i >= 1; i--)
{
delay(2);
gotoxy(1, i);
clrscr();
}
}
else
{
clrscr();
gotoxy(30,10);
cout<<"Invalid Password";
getch();
}
}
// Function for modify record and delete record menu
void Tariff_Menu(void)
{
char ch;
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
while (1)
{
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(GREEN);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);
outtextxy(260,80,"Tariff Menu");
setcolor(BLUE);
rectangle(200,120,455,320);
settextstyle(1,HORIZ_DIR,3);
outtextxy(220,130, " 1: Create Tariff");

outtextxy(230,160,"2.
outtextxy(230,190,"3.
outtextxy(230,220,"4.
outtextxy(230,250,"5.
outtextxy(230,280,"6.

Search Tariff");
Modify Tariff");
Delete Tariff");
Display Tariff");
0 to Quit");

outtextxy(230,320,"Enter your choice : ");


ch = getche();
closegraph();
tariff tt1;
switch(ch)
{
case '1': tt1.tcreate();break;
case '2': tt1.tsearch();break;
case '3': tt1.tupdate();break;
case '4':tt1.tdelete();break;
case '5':tt1.tdisplay();break;
case '6':break;
}
if(ch == '0')
break;
}
}
void Room_Menu(void)
{
char ch;
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
while (1)
{
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(GREEN);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);
outtextxy(260,80,"Room Menu");
setcolor(BLUE);
rectangle(200,120,455,320);
settextstyle(1,HORIZ_DIR,3);
outtextxy(220,130, " 1: Create Room");
outtextxy(230,160,"2. Search Room");
outtextxy(230,190,"3. Modify Room");
outtextxy(230,220,"4. Delete Room");
outtextxy(230,250,"5. Display Room");
outtextxy(230,280,"6. 0 to Quit");
outtextxy(230,320,"Enter your choice : ");
ch = getche();
closegraph();
room rr1;
switch(ch)
{
case
case
case
case
case

'1': rr1.rcreate();break;
'2': rr1.rsearch();break;
'3': rr1.rupdate();break;
'4':rr1.rdelete();break;
'5':rr1.rdisplay();break;

case '6':break;
}
if(ch == '0')
break;
}
}
void Room_Booking(void)
{
char ch;
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
while (1)
{
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(GREEN);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);
outtextxy(260,80,"Room Booking");
setcolor(BLUE);
rectangle(200,120,510,320);
settextstyle(1,HORIZ_DIR,3);
outtextxy(220,130, " 1: Create Customer");
outtextxy(230,160,"2. Search Customer");
outtextxy(230,190,"3. Modify Customer");
outtextxy(230,220,"4. Delete All RCustomer");
outtextxy(230,250,"5. Display Customer");
outtextxy(230,280,"6. 0 to Quit");
outtextxy(230,320,"Enter your choice : ");
ch = getche();
closegraph();
customer cc1;
switch(ch)
{
case
case
case
case
case
case
}
if(ch == '0')
break;
}
}
void Bill_Menu(void)

{
char ch;

'1': cc1.ccreate();break;
'2': cc1.csearch();break;
'3': cc1.cupdate();break;
'4':cc1.cdelete();break;
'5':cc1.cdisplay();break;
'6':break;

/* request auto detection */


int gdriver = DETECT, gmode, errorcode;
while (1)
{
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(GREEN);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);
outtextxy(260,80,"Bill Menu");
setcolor(BLUE);
rectangle(200,120,510,290);
settextstyle(1,HORIZ_DIR,3);
outtextxy(220,130, " 1: Create Bill");
outtextxy(230,160,"2. Search Bill");
outtextxy(230,190,"3. Delete All RCustomer");
outtextxy(230,220,"4. Display Bill");
outtextxy(230,250,"5. 0 to Quit");
outtextxy(230,300,"Enter your choice : ");
ch = getche();
closegraph();
bill bb1;
switch(ch)
{
case
case
case
case
case

'1': bb1.bcreate();break;
'2': bb1.bsearch();break;
'3': bb1.bdelete();break;
'4':bb1.bdisplay();break;
'5':break;

}
if(ch == '0')
break;
}
}
void Report(void)
{
char ch;
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
while (1)
{
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(GREEN);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);
outtextxy(300,80,"Report");
setcolor(BLUE);
rectangle(200,120,510,270);
settextstyle(1,HORIZ_DIR,3);
outtextxy(220,130,"1: Room Report");
outtextxy(230,160,"2. Customer Report");
outtextxy(230,190,"3. Bill Report");
outtextxy(230,220,"4. 0 to Quit");
outtextxy(230,300,"Enter your choice : ");

ch = getche();
closegraph();
if (ch == 27)
break;
else
if (ch == '1')
{
Room_Report();
//break;
}
else
if (ch == '2')
{
Customer_Report();
}
else
if (ch == '3')
{
Bill_Report();
}
else
if (ch == '0')
break;
}
}

void Room_Report(void)
{
char ch;
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
while (1)
{
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(GREEN);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);
outtextxy(260,80,"Room Report");
setcolor(BLUE);
rectangle(175,120,520,250);
settextstyle(1,HORIZ_DIR,3);
outtextxy(200,130, " 1: Vaccant Room Report");
outtextxy(210,160,"2. Occupied Room Report");
outtextxy(210,190,"3. 0 to Back");
outtextxy(210,260,"Enter your choice : ");
ch = getche();
closegraph();
room rr1;
switch(ch)
{
case '1': rr1.vreport();
break;
case '2': rr1.oreport();
break;

case '3':break;
}
if(ch == '0')
break;
}
}

void Customer_Report(void)
{
char ch;
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
while (1)
{
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(GREEN);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);
outtextxy(260,80,"Customer Report");
setcolor(BLUE);
rectangle(175,120,520,250);
settextstyle(1,HORIZ_DIR,3);
outtextxy(180,130, " 1. Present Customer Report");
outtextxy(190,160,"2. Absent Customer Report");
outtextxy(190,190,"3. 0 to Back");
outtextxy(190,260,"Enter your choice : ");
ch = getche();
closegraph();
customer cc1;
switch(ch)
{
case '1': cc1.preport();break;
case '2': cc1.areport();break;
case '3':break;
}
if(ch == '0')
break;
}
}

void Bill_Report(void)
{
char ch;
/* request auto detection */
int gdriver = DETECT, gmode, errorcode;
while (1)
{
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(GREEN);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);

outtextxy(260,80,"Bill Report");
setcolor(BLUE);
rectangle(175,120,520,250);
settextstyle(1,HORIZ_DIR,3);
outtextxy(200,130, " 1: Daily Invoice Report");
outtextxy(210,160,"2. Monthly Invoice Report");
outtextxy(210,190,"3. 0 to Back");
outtextxy(210,260,"Enter your choice : ");
ch = getche();
closegraph();
bill bb1;
switch(ch)
{
case '1': bb1.dailyreport();break;
case '2': bb1.monthlyreport();break;
case '3':break;
}
if(ch == '0')
break;
}
}
void Start()
{
int gdriver = DETECT, gmode, errorcode;
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(WHITE);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);
outtextxy(120,30,"WELCOME TO ROOM BOOKING SYSTEM");
setcolor(GREEN);
rectangle(80,65,580,60);
rectangle(60,30,600,380);
setcolor(RED);
settextstyle(3,0,3);
outtextxy(160,80,"HOTEL SAMRAT INTERNATIONAL");
settextstyle(3,0,1);
outtextxy(280,110,"An Unit Of");
settextstyle(3,0,3);
outtextxy(180,130,"HOTEL CHANAKYA Pvt. Ltd.");
settextstyle(3,0,1);
outtextxy(280,160,"Fraser Road");
settextstyle(3,0,1);
outtextxy(270,180,"Patna 800001");
setcolor(CYAN);
settextstyle(1,0,1);
outtextxy(80,280,"Guided by,");
outtextxy(80,300,"DEEPAK KUMAR");
outtextxy(410,280,"Developed by,");
outtextxy(410,300,"SHIVPUJAN PRASAD");
outtextxy(410,320,"Reg. No.:R/1042/2000");
outtextxy(410,340,"ROLL NO.- 05523");
setcolor(RED);
outtextxy(80,380,"Press any key to continue......");
getche();
}

void End()
{
int gdriver = DETECT, gmode, errorcode;
/* initialize graphics mode */
initgraph(&gdriver, &gmode, "C:\\TC\\BGI");
setbkcolor(WHITE);
setcolor(BLUE);
settextstyle(1,HORIZ_DIR,3);
outtextxy(220,30,"ROOM BOOKING SYSTEM");
setcolor(GREEN);
rectangle(80,65,580,60);
rectangle(60,30,600,380);
setcolor(RED);
settextstyle(3,0,3);
outtextxy(190,80,"HOTEL SAMRAT INTERNATIONAL");
settextstyle(3,0,1);
outtextxy(280,110,"An Unit Of");
settextstyle(3,0,3);
outtextxy(180,130,"HOTEL CHANAKYA Pvt. Ltd.");
settextstyle(3,0,1);
outtextxy(280,160,"Fraser Road");
settextstyle(3,0,1);
outtextxy(270,180,"Patna 800001");
setcolor(BLUE);
settextstyle(1,0,1);
outtextxy(80,280,"Guided by,");
outtextxy(80,300,"DEEPAK KUMAR");
// outtextxy(80,320,"MCA");
outtextxy(410,280,"Developed by,");
outtextxy(410,300,"SHIVPUJAN PRASAD");
outtextxy(410,320,"Reg. No.:R/1042/2000");
outtextxy(410,340,"ROLL NO.- 05523");
outtextxy(80,380,"Thank you for using this software......");
getche();
}

Das könnte Ihnen auch gefallen