Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

help needed "hotel managemet program" C++

bardhi232bardhi232 Member Posts: 2
[code]
#include
#include
#include
#include
#include
#include
#define max 100
using namespace std;
//Class Person

class Person
{
public:
char *name;
char *address;
char *phone;
};


class Room
{
public:
char type;
char stype;
char ac;
int roomNumber;
int rent;
int status;
class Person cust;
class Room addRoom(int);
void searchRoom(int);
void deleteRoom(int);
void displayRoom(Room);
};
//Global Declarations

class Room rooms[max];
int count=0;


Room Room::addRoom(int rno)
{
class Room room;
room.roomNumber=rno;
cout<<"
Type AC/Non-AC (A/N) ";
cin>>room.ac;
cout<<"
Type Comfort (S/N)";
cin>>room.type;
cout<<"
Type Size (B/S) ";
cin>>room.stype;
cout<<"
Rent: ";
cin>>room.rent;
room.status=0;
return room;
}


void Room::searchRoom(int rno)
{
int i,found=0;
for(i=0;i>rno;
for(i=0;i>rooms[i].cust.name;
cout<<"
Enter Customer Address: ";
cin>>rooms[i].cust.address;
cout<<"
Enter Customer Phone Number: ";
cin>>rooms[i].cust.phone;
rooms[i].status=1;
}
}


//hotel management shows available rooms
void HotelMgnt::getAvailRoom()
{
int i,found=0;
for(i=0;i>days;
billAmount=days * rooms[i].rent;
cout<<"
Total Bill Amount: LEK. "<<billAmount<<" /";
rooms[i].status=0;
}
getch();
}


//managing rooms (adding and searching available rooms)
void manageRooms()
{
class Room room;
int opt,rno,i,flag=0;
char ch;
do
{
system("cls");
cout<<"Hotel Management
";
cout<<"
Manage Room";
cout<<"
1. Add Room";
cout<<"
2. Search Room";
cout<<"
3. Back to Main Menu";
cout<<"
Enter Option: ";
cin>>opt;


//switch statement
switch(opt)
{
case 1:
cout<<"
Enter Room Number:t";
cin>>rno;
i=0;
for(i=0;i>rno;
room.searchRoom(rno);
break;
case 3:
// cout<<"Do you want to Exit (Y/N:) ";
// cin>>ch;
break;
default:
cout<<"
Please Enter correct option";
break;
}
}while(opt!=3);
}
using namespace std;
int main()
{
class HotelMgnt hm;
int i,j,opt,rno;
char ch;
char *pname;
system("cls");
do
{
system("cls");
cout<<"Hotel Management
";
cout<<"
1. Manage Rooms";
cout<<"
2. Reserve Room";
cout<<"
3. Available Rooms";
cout<<"
4. Search Person";
cout<<"
5. Generate Bill";
cout<<"
6. Exit";
cout<<"
Enter Option:t";
cin>>opt;
switch(opt)
{
case 1:
manageRooms();
break;
case 2:
if(count==0)
{
cout<<"
Rooms data is not available.
Please add the rooms first.";
getch();
}
else
hm.reserveRoom();
break;
case 3:
if(count==0)
{
cout<<"
Rooms data is not available.
Please add the rooms first.";
getch();
}
else
hm.getAvailRoom();
break;
case 4:
if(count==0)
{
cout<<"
Rooms data is not available.
Please add the rooms first.";
getch();
}
else
{
cout<<"Enter Person Name: ";
cin>>pname;
hm.searchPerson(pname);
}
break;
case 5:
if(count==0)
{
cout<<"
Rooms data is not available.
Please add the rooms first.";
getch();
}
else
{
cout<<"Enter Room Number: ";
cin>>rno;
hm.generateBill(rno);
}
break;
case 6:
cout<<"
THANK YOU!";
break;
default:
cout<<"
Please Enter correct option";
break;
}
}while(opt!=6);
getch();
}

[/code]


This is the code of my final project on computer science "Hotel Management Program" and I'm having some issues that i don't understand with it. When i compile the code, compiler doesn't show any errors. I can add rooms, search rooms, but when i use the "reserve room button" and I write the "costumer name" the program crashes. I tried everything I know to fix the problem and even I did many research on internet about that, but still i can't figure it out. If someone could compile the code and have a look at it (DEV C++) it would help me a lot, because the deadline is coming. I think that for a pro programmer it will take only 2 min, because i think that there is some silly mistake that i did and can't figure it out. Thank You in advance!
Sign In or Register to comment.