You are here:

C++/exception 13

Advertisement


Question
while compiling i got an exception 13 error. can u help me fix it.
i used turbo c++ on win xp.
i'm a plus two student and haven't gone into an in-depth study of the language.this code is my project 4 boards.
on compiling the code,the error message was as follows:
general protection fault at 0AD7:0A31 ERROR CODE-3A00
ax=3A00,bx=029C,cx=08CA,dx=3A00,di=0002,si=E2DE
ds=069F limit=FFFF segment# 004D C:TCBINTC.EXE
es=13aF limit=044F segment#
cs=0A07 limit=1D3B segment# 00A9 C:TCBINTC.EXE
ss=069F limit=FFFF segment# 004D C:TCBIBTC.EXE
error code=3A00 limit=INVL segment#
wen i removd d class Date part of d code,the exception error didn't show up.
the code is as follows:
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
#include<ctype.h>
#include<stdio.h>
ifstream flight("Flights.dat",ios::binary);
ifstream hotel("Hotels.dat",ios::binary);
ifstream rail("Rails.dat",ios::binary);
ifstream bus("Bus.dat",ios::binary);
ifstream holiday("Holidays.dat",ios::binary);
ifstream place("Places.dat",ios::binary);
ifstream booking("Booked.dat",ios::binary);
ofstream book("Booked.dat",ios::binary,ios::app);
ifstream read_record("Record.dat",ios::binary);
ofstream write_record("Record.dat",ios::binary,ios::app);
int leave=0;
int destination=0;

int depart_time=0;
int adults=0;
int children=0;
int infants=0;
int j=0;
int c=0;
int duration=0;
float f=0.0;
class Place
{
private:
char name[20];
int code;
public:
void assign()
{
cout<<"Name:";
gets(name);
place.seekg(0,ios::beg);
code=6000+(place.tellg()/sizeof(Place))+1;
}
int get_code()
{
return code;
}
void display()
{
puts(name);
cout<<"("<<code<<")";
}
};
class Date
{
private:
int day;
int month;
int year;
public:
void enter_date();
void copy(Date d);
void display()
{
cout<<day<<"."<<month<<"."<<year;
}
void refresh()
{
day=0;
month=0;
year=0;
}
int get_day()
{
return day;
}
int get_month()
{
return month;
}
int get_year()
{
return year;
}
};
void Date::enter_date()
{
int correct=0;
do{
cout<<"Day:";
cin>>day;
cout<<"Month:";
cin>>month;
cout<<"Year:";
cin>>year;
/* if((day>0)||(day<32)||(month>0)||(month<13)||(year>2009)||(year<2014))
{
if(((month==4)||(month==6)||(month==11)||(month==9))&&(day==31))
{
cout<<"Invalid date.
Please re-enter correct date:
";
continue;
}
else if((month==2)&&(day>28))
{
if((year==2012)&&(day==29))
{
cout<<"Date verified:Valid.
";
correct=1;
continue;
}
else
{
cout<<"Invalid date.
Please re-enter corrcet date:
";
continue;
}
}
else
{
cout<<"Date verified:Valid.
";
correct=1;
continue;
}
}
else
{
cout<<"Invalid date.
Please re-enter correct date:
";
continue;
}
}while(correct==0);
} */
void Date::copy(Date d)
{
day=d.get_day();
month=d.get_month();
year=d.get_year();
}
Date date;
class Password
{
private:
char pass[20];
public:
Password()
{
strcpy(pass,"9830182259");
}
void change_pass(Record r);
int compare_pass(char p[20]);
};

void Password::change_pass()
{
char new_pass[20];
cout<<"Enter current password
";
gets(new_pass);
if(compare_pass(new_pass))
{
cout<<"Enter new password
";
gets(new_pass);
strcpy(pass,new_pass);
cout<<"Password changed successfully
";
}
else
cout<<"Invalid password
Access Denied!!
";
}


int Password::compare_pass(char p[20])
{
for(int i=0;i<20;i++)
{
if(pass[i]==p[i])
continue;
else
return 0;
}
return 1;
}
Password *p=new Password();
ofstream write_pass("Password.dat",ios::binary);
write_pass.write((char*)&p,sizeof(p));
class Record
{
private:
Date d;
int code;
int left;
public:
int compare(Record r)
{
if((r.get_date().get_day()==d.get_day())&&(r.get_date().get_month()==d.get_month())&&(r.get_date().get_year()==d.get_year())&&(r.get_code()==code))
return 1;
else
return 0;
}
void get(int a,int b)
{
code=a;
d.copy(date);
left=b;
}
void copy(Record r)
{
d.copy(r.get_date());
code=r.get_code();
left=r.get_left();
}
Date get_date()
{
return d;
}
int get_code()
{
return code;
}
int get_left()
{
return left;
}
};
class Flight
{
private:
int f_code;
char op[20];
int operator_code;
Place from;
Place to;
int time;
int time_code;
int fare;
int economy_seats;
int business_seats;
public:
void check_availability();

void assign()
{
flight.seekg(0,ios::end);
f_code=1000+(flight.tellg()/sizeof(Flight))+1;
cout<<"
Operator:";
gets(op);
cout<<"
Deparure:";
from.assign();
cout<<"
Arrival:";
to.assign();
cout<<"
Departure time:";
cin>>time;
if(time>500 && time<=1200)
time_code=1;
else if(time>1200 && time<=1800)
time_code=2;
else if(time>1800 && time<=0)
time_code=3;
else
time_code=4;
cout<<"
Fare: Rs.";
cin>>fare;
cout<<"
Economy seats:";
cin>>economy_seats;
cout<<"
Business seats:";
cin>>business_seats;
}
int check(int k,int l)
{
if((k==from.get_code())&&(l==to.get_code()))
return f_code;
else
return 0;
}
int get_code()
{
return f_code;
}
int get_time_code()
{
return time_code;
}
int get_fare()
{
return fare;
}
void short_display()
{
cout<<"Flight code:"<<f_code<<"   ";
puts(op);
}
void display()
{
cout<<"Flight code:"<<f_code<<"   ";
puts(op);
cout<<"
From:";
from.display();
cout<<"
To:";
to.display();
cout<<"
Date:";
date.display();
cout<<"
Time:"<<time<<"
Fare:Rs.";
f=fare*adults*1.0+fare*children*0.5+fare*infants*0.1;
cout<<f<<endl;
}
};
void Flight::check_availability(Record r)
{
Record rec;
r.get(f_code,economy_seats+business_seats);
read_record.seekg(0,ios::beg);
while(read_record)
{
read_record.read((char*)& rec, sizeof(rec));
if(rec.compare(r))
{
r.copy(rec);
break;
}
}
}
class Hotel
{
private:
int h_code;
char name[20];
int star;
Place p;
int rooms;
int avg_daily_rate;
int xtra_perday;
char amenities[200];
public:
void check_availability(Record r);
void assign()
{
hotel.seekg(0,ios::end);
h_code=2000+(hotel.tellg()/sizeof(Hotel))+1;
cout<<"Name:";
gets(name);
cout<<"Star rating:";
cin>>star;
cout<<"Location:";
p.assign();
cout<<"Number of Rooms:";
cin>>rooms;
cout<<"Average daily rate: Rs.";
cin>>avg_daily_rate;
cout<<"Extra per day:Rs:";
cin>>xtra_perday;
cout<<"Amenities:";
gets(amenities);
}
void short_display()
{
puts(name);
cout<<"("<<h_code<<")   "<<star<<" star
";
}
void display()
{
puts(name);
cout<<"("<<h_code<<")
"<<star<<" star
"<<"Avg daily rate:Rs."<<avg_daily_rate;
cout<<"
Amenities:";
puts(amenities);
cout<<endl;
}
int get_code()
{
return h_code;
}
int get_location()
{
return p.get_code();
}
};
void Hotel::check_availability(Record r)
{
Record rec;
r.get(h_code,rooms);
read_record.seekg(0,ios::beg);
while(read_record)
{
read_record.read((char*)& rec, sizeof(rec));
if(rec.compare(r))
{
r.copy(rec);
break;
}
}
}
class Rail
{
private:
int r_code;
char train[30];
int seats;
Place from;
Place to;
int time[10];
Place stations[10];
float fare[10];
public:
void assign();
void check_availability(Record r);
int check(int x,int y);

int get_code()
{
return r_code;
}
void short_display()
{
cout<<"Train code:"<<r_code<<"   Name:";
puts(train);
}

};
void Rail::assign()
{
rail.seekg(0,ios::end);
r_code=3000+(rail.tellg()/sizeof(Rail))+1;
cout<<"Train name:
";
gets(train);
cout<<"
Enter number of seats:";
cin>>seats;
cout<<"
Starting location:";
from.assign();
cout<<"
Destination station:";
to.assign();
cout<<"
Enter stoppages:";
for(int i=0;i<10;i++)
{
cout<<"
Station "<<(i+1);
stations[i].assign();
cout<<"
Time:";
cin>>time[i];
cout<<"
Fare from previous station: Rs.";
cin>>fare[i];
}
}
int Rail::check(int x,int y)
{
int result=0;
int d=0;
if(x==from.get_code())
result=1;
else
{
for(d=0;d<10;d++)
{
if(x==stations[d].get_code())
result=1;
}
}
if(result)
{
result=0;
for(;d<10;d++)
{
if(y==stations[d].get_code())
result=1;
}
if(!result)
{
if(y==to.get_code())
result=1;
}
}
if(result)
return r_code;
else
return 0;
}
void Rail::check_availability(Record r)
{
Record rec;
r.get(r_code,seats);
read_record.seekg(0,ios::beg);
while(read_record)
{
read_record.read((char*)& rec, sizeof(rec));
if(rec.compare(r))
{
r.copy(rec);
break;
}
}
}
class Bus
{
private:
int b_code;
char op[20];
int operator_code;
Place from;
Place to;
Place stoppages[10];
int time[10];
float fare[10];
int seats;
public:
int check(int x,int y);
void check_availability(Record r);
void assign();
int get_code()
{
return b_code;
}
void short_display()
{
cout<<"Bus code:"<<b_code<<"   Operator:";
puts(op);
}
};
void Bus::assign()
{
bus.seekg(0,ios::end);
b_code=3000+(bus.tellg()/sizeof(Bus))+1;
cout<<"Train name:
";
gets(op);
cout<<"
Enter number of seats:";
cin>>seats;
cout<<"
Starting location:";
from.assign();
cout<<"
Destination station:";
to.assign();
cout<<"
Enter stoppages:";
for(int i=0;i<10;i++)
{
cout<<"
Station "<<i+1;
stoppages[i].assign();
cout<<"
Time:";
cin>>time[i];
cout<<"
Fare from previous station: Rs.";
cin>>fare[i];
}
}
int Bus::check(int x,int y)
{
int result=0;
int d=0;
if(x==from.get_code())
result=1;
else
{
for(d=0;d<10;d++)
{
if(x==stoppages[d].get_code())
result=1;
}
}
if(result)
{
result=0;
for(;d<10;d++)
{
if(y==stoppages[d].get_code())
result=1;
}
if(!result)
{
if(y==to.get_code())
result=1;
}
}
if(result)
return b_code;
else
return 0;
}
void Bus::check_availability(Record r)
{
Record rec;
r.get(b_code,seats);
read_record.seekg(0,ios::beg);
while(read_record)
{
read_record.read((char*)& rec, sizeof(rec));
if(rec.compare(r))
{
r.copy(rec);
break;
}
}
}
class Booked
{
private:
int ref_no;
int code;
int l;
int dest;
char names[6][20];
float fare;
char credit_card[16];
int conf;
Date d;
int preference;
char e_mail[25];
public:
void display();
int confirm(int k, int l);
int get_reference()
{
return ref_no;
}
};
void Booked::display()
{
cout<<"Reference No.:"<<ref_no<<endl;
cout<<"Travellers:
";
for(int a=0;a<6;a++)
{
cout<<(a+1)<<". ";
puts(names[a]);
}
cout<<"Total fare- Rs."<<fare;
cout<<"Date:";
d.display();
}
int Booked::confirm(int k, int l)
{
l=leave;
dest=destination;
d.copy(date);
preference=l;
code=k;
k=0;
fare=f;
cout<<"
Please enter the names of the travellers(excluding infants):
";
cout<<"
When done enter 0
";
do
{
gets(names[k]);
k++;
}while(names[k][0]!='0');
booking.seekg(0,ios::end);
ref_no=7000+(booking.tellg()/sizeof(Booked))+1;
cout<<"
Credit card number:";
gets(credit_card);
cout<<"e-mail id:
";
gets(e_mail);
if(k-1!=0) conf=1;
else conf=0;
return conf;
}
class Holiday
{
private:
Place leave;
Place destination;
char theme[20];
int theme_code;
int h_code;
int duration;
float fare;
char description[300];
public:
void assign()
{
holiday.seekg(0,ios::end);
h_code=5000+(holiday.tellg()/sizeof(Holiday))+1;
cout<<"
Departure:";
leave.assign();
cout<<"
Destination:";
destination.assign();
cout<<"
Theme:";
gets(theme);
cout<<"
Duration:";
cin>>"duration";
cout<<"
Fare: Rs.";
cin>>fare;'
cout<<"
Description:";
gets(description);
}
void short_display()
{
cout<<"Destination:";
p.display();
cout<<"   Code:"<<h_code;
cout<<"   Duration:"<<duration<<" days";
}
void display()
{
cout<<"Destination:";
destination.display();
cout<<"
Flight will be provided from ";
leave.display();
cout<<"
Holiday theme:";
puts(theme);
cout<<"
Duration:"<<duration<<" days
Fare: Rs."<<fare<<" per person
Duration";
}
};


void menu()
{
cout<<"1. Flights"<<endl;
cout<<"2. Hotels"<<endl;
cout<<"3. Railways"<<endl;
cout<<"4. Bus"<<endl;
cout<<"5. Holidays"<<endl;
cout<<"6. Check status"<<endl;
cout<<"7. Login(for authorised personnel only)";
cout<<"8. Exit";
}
void login_menu()
{
cout<<"
Login menu";
cout<<"1. Add new flight
";
cout<<"2. Add new hotel
";
cout<<"3. Add new train
";
cout<<"4. Add new bus
";
cout<<"5. Add new holiday
";
cout<<"6. Add new place
";
cout<<"7. Change password
";
cout<<"8. Return to previous menu
";
cout<<"Enter your option(1-7):";
}
void display_cities()
{
Place p;
j=1;
place.seekg(0);
while(!place)
{
place.read((char*)& p, sizeof(Place));
cout<<j<<".";
p.display();
cout<<endl;
j++;
}
cout<<"Enter the city code:";
}
void read_info(int ch)
{
if(ch!=2||ch!=5)
{
cout<<"Leaving from:
";
display_cities();
cin>>leave;
}
cout<<"
Going to:
";
display_cities();
cin>>destination;
if(ch!=2)
cout<<"Departure date:";
else
cout<<"Arrival date:";
date.enter_date();
if(ch==1)
{
cout<<"
Choose departure time
1. 0500-1200
2. 1200-1800
3. 1800-0000
4. 0000-0500
";
cin>>depart_time;
}
cout<<"Travellers(upto 6 per booking):
";
cout<<"Adults(12+):";
cin>>adults;
cout<<"
Children(2-11):";
cin>>children;
cout<<"
Infants(0-2):";
cin>>infants;
}
void holiday_info()
{
cout<<"Destination:";
display_cities();
cin>>destination;
cout<<"
Duration:
1.1-4 days
2.4-7 days
3.7+ days";
cin>>duration;
}
int search_flight()
{
Flight f;
int a1;
int found=0;
flight.seekg(0);
cout<<"Search results:
";
while(flight)
{
flight.read((char*)& f, sizeof(Flight));
if((f.check(leave,destination))&&(f.get_time_code()==depart_time))
{
f.short_display();
found=1;
}
}
if(found)
{
cout<<"Enter flight code to get more information:
";
cin>>a1;
return a1;
}
else
return 0;
}
int search_hotels()
{
Hotel h;
int a2;
int found=0;
while(hotel)
{
hotel.read((char*)& h, sizeof(Hotel));
if(destination==h.get_location())
{
found=1;
h.short_display();
}
}
if(found)
{
cout<<"Enter hotel code to get more information:
";
cin>>a2;
return a2;
}
else
return 0;
}
int search_rails()
{
Rail r;
int a3;
int found=0;
rail.seekg(0);
while(rail)
{
rail.read((char*)& r,sizeof(Rail));
if(r.check(leave,destination))
{
found=1;
r.short_display();
}
}
if(found)
{
cout<<"Enter train code to get more information:
";
cin>>a3;
return a3;
}
else
return 0;
}

int search_buses()
{
Bus b;
int a4;
int found=0;
bus.seekg(0);
while(bus)
{
bus.read((char*)& b,sizeof(Bus));
if(b.check(leave,destination))
{
found=1;
b.short_display();
}
}
if(found)
{
cout<<"Enter bus code to get more information:
";
cin>>a4;
return a4;
}
else
return 0;
}
int search_holiday()
{
Holiday h;
int a5;
int found=0;
holiday.seekg(0);
while(holiday)
{
holiday.read((char*)& h,sizeof(Holiday));
if(h.get_destination()==destination)
{
found=1;
h.short_display();
}
}
if(found)
{
cout<<"Enter holiday code to get more information:
"
cin>>a5;
return a5;
}
else
return 0;
}
void refresh()
{
leave=0;
destination=0;
date.refresh();
depart_time=0;
adults=0;
children=0;
infants=0;
j=0;
c=0;
duration=0;
}
void book(int code, int choice)
{
int check=0;
char ch;
Record r;
Booked b;
cout<<"
You have selected the following ";
switch(choice)
{
case 1: Flight f;
flight.seekg(0,ios::beg);
while(flight)
{
flight.read((char*)& f,sizeof(f));
if(code==f.get_code())
break;
}
cout<<"flight:";
f.display();
cout<<"
Checking availability
";
f.check_availability(r);
if(r.get_left()!=0)
{
cout<<"Seats available
";
check=1;
}
else
cout<<"Sorry! Seats unavailable
";
break;
case 2: Hotel h;
hotel.seekg(0,ios::beg);
while(hotel)
{
hotel.read((char*)& h,sizeof(h));
if(code==h.get_code())
break;
}
cout<<"hotel:";
h.display();
cout<<"
Checking availability
";
h.check_availability(r);
if(r.get_left()!=0)
{
cout<<"Seats available
";
check=1;
}
else
cout<<"Sorry! Seats unavailable
";
break;
case 3: Rail rl;
rail.seekg(0,ios::beg);
while(rail)
{
rail.read((char*)& f,sizeof(rl));
if(code==rl.get_code())
break;
}
cout<<"flight:";
rl.display();
cout<<"
Checking availability
";
rl.check_availability(r);
if(r.get_left()!=0)
{
cout<<"Seats available
";
check=1;
}
else
cout<<"Sorry! Seats unavailable
";
break;
case 4: Bus b;
bus.seekg(0,ios::beg);
while(bus)
{
bus.read((char*)& b,sizeof(b));
if(code==b.get_code())
break;
}
cout<<"bus:";
b.display();
cout<<"
Checking availability
";
b.check_availability(r);
if(r.get_left()!=0)
{
cout<<"Seats available
";
check=1;
}
else
cout<<"Sorry! Seats unavailable
";
break;
case 5: Holiday h;
holiday.seekg(0,ios::beg);
while(holiday)
{
holiday.read((char*)& h,sizeof(h));
if(code==h.get_code())
break;
}
cout<<"holiday:";
h.display();
cout<<"
Checking availability
";
h.check_availability(r);
if(r.get_left()!=0)
{
cout<<"Seats available
";
check=1;
}
else
cout<<"Sorry! Seats unavailable
";
break;
}
if(check)
{
cout<<"Confirm this booking?(y/n):";
cin>>ch;
if((ch=='y')||(ch=='Y))
check=b.confirm(code,choice);
if(check)
{
r.update();
cout<<"
Your booking has been confirmed.
Ypur reference number is:"<<b.get_reference();
book.write((char*)& b,sizf(b));
write_record.seekp(read_record.tellg()-sizeof(r),ios::beg);
write_record.write((char*)& r,sizeof(r));
}
else
cout<<"Unable to confirm booking,";
}
}
void check_status()
{
cout<<"Reference number:";
int n;
cin>>n;
Booked b;
booking.seekg(0,ios::beg);
while(booking)
{
booking.read((char*)& b,sizeof(b));
if(n==b.get_reference())
{
b.display();
break;
}
else
n=0;
}
if(!n)
cout<<"Invalid reference number.
Please make sure that the number you have entered is correct.";
}
void login()
{
ofstream get_flight("Flights.dat",ios::binary,ios::app);
ofstream get_hotel("Hotel.dat",ios::binary,ios::app);
ofstream get_rail("Rails.dat",ios::binary,ios::app);
ofstream get_bus("Bus.dat",ios::binary,ios::app);
ofstream get_holiday("Holiday.dat",ios::binary,ios::app);
ofstream get_place("Places.dat",ios::binary,ios::app);
ifstream read_pass("Password.dat",ios::binary);
int choice;
char pass[20];
Password p;
read_pass.read((char*)& p,sizeof(p));
cout<<"Password:";
gets(pass);
if(p.compare_pass(pass))
{
do
{
login_menu();
cin>>choice;
switch(choice)
{
case 1: Flight f;
f.assign();
get_flight.write((char*)& f,sizeof(f));
break;
case 2: Hotel h;
h.assign();
get_hotel.write((char*)& h,sizeof(h));
break;
case 3: Rail r;
r.assign();
get_rail.write((char*)& r,sizeof(r));
break;
case 4: Bus b;
b.assign();
get_bus.write((char*)& b,sizeof(b));
break;
case 5: Holiday h;
h.assign();
get_holiday.write((char*)& h,sizeof(h));
break;
case 6: Place p;
p.assign();
get_place.write((chr*)& p,sizeof(p));
break;
case 7: cout<<"Password:
";
p.change_pass();
write_pass.write((char*)& p,sizeof(p));
break;
case 8: cout<<"
Exiting...
";
break;
default:cout<<"
Invalid option.
Access denied.";
}
}while(choice!=7);
}
else
cout<<"Invalid password!!
Access denied...";
}

void main()
{
cout<<"Welcome to KHK Travel Agency"<<endl;
int choice;
do{
menu();
cout<<"Enter your option:"<<endl;
cin>>choice;
switch(choice)
{
case 1: cout<<"Booking Flights
";
read_info(choice);
if(c=search_flight())
{
book(c,choice);
}
else
{
cout<<"Sorry.There does not exist any flight between the destinations you entered.
";
}
refresh();
break;
case 2: cout<<"Booking Hotels
";
read_info(choice);
if(c=search_hotels())
{
book(c,choice);
}
else
{
cout<<"Sorry.There does not exist any hotel under our network in the place specified by you.
";
}
refresh();
break;
case 3: cout<<"Online Railway Reservation
";
read_info(choice);
if(c=search_rails())
{
book(c,choice);
}
else
{
cout<<"Sorry.No train routes exist between the stations you entered.
";
}
refresh();
break;
case 4: cout<<"Online Bus Seats Booking
";
read_info(choice);
if(c=search_buses())
{
book(c,choice);
}
else
{
cout<<"Sorry.No bus routes exist between the places you entered.
";
}
refresh();
break;
case 5: cout<<"Planning Holidays
";
holiday_info();
if(c=search_holidays())
{
book(c,choice);
}
else
{
cout<<"Sorry.Our travel agency does not arrange holidays in the city you entered.
";
}
refresh();
break;
case 6: check_status();
break;
case 7: login();
break;
case 8: cout<<"Thank You for using KHK Travel Agency.
Please visit again.
";
break;
default: cout<<"Invalid input!!
Please enter your option again.
";
}
}while(choice!=7);
}

Answer
Hello Harsha. I have bad news for you. Your code has many problems. I have removed many of them but there are 24 left that you need to work on. I hope that the code is now in a condition that will not crash your turbo C compiler. No matter how invalid the code is, the compiler should not crash. You have found a defect in the turbo C compiler.

When writing code you should compile often. You should never wait until the entire program is typed in before trying to compile. That way, if you are making a mistake with the language, you will learn about your mistake before you repeat it hundreds of times. I like to compile my program, or the file I'm working on after every function is added. Sometimes when working with an unfamiliar language, I compile a file after every few lines.

You obviously have a misunderstanding about how cout works, and you have repeated your misunderstanding many times.

I have made comments in your code starting with /*XXX

Have a look at those comments and continue working on the errors in the program.

Best regards
Zlatko

Here is the code:

/*XXX
in C/C++ you cannot have a string starting with a quote and spanning multiple lines
You cannot have this:
cout << "abc
def
ghi"

you must use this
cout << "abc"
"def"
"ghi"

when a string spans multiple lines, each line must be in quotes.

If you want a newline printed you must use the \n character

The above example prints abcdefghi

If you want it in three lines, like this
abc
def
ghi

you must do this:

cout << "abc\n"
"def\n"
"ghi\n"

or this

cout << "abc\ndef\nghi\n"

You have not put in newline characters into any of your strings. All your output will
come out on one line. Your job is to add the newline characters.

*/


#include<iostream.h>
#include<conio.h>
#include<fstream.h>
#include<string.h>
#include<ctype.h>
#include<stdio.h>

ifstream flight("Flights.dat",ios::binary);
ifstream hotel("Hotels.dat",ios::binary);
ifstream rail("Rails.dat",ios::binary);
ifstream bus("Bus.dat",ios::binary);
ifstream holiday("Holidays.dat",ios::binary);
ifstream place("Places.dat",ios::binary);
ifstream booking("Booked.dat",ios::binary);
ofstream book("Booked.dat",ios::binary,ios::app);
ifstream read_record("Record.dat",ios::binary);
ofstream write_record("Record.dat",ios::binary,ios::app);
int leave=0;
int destination=0;

int depart_time=0;
int adults=0;
int children=0;
int infants=0;
int j=0;
int c=0;
int duration=0;
float f=0.0;
class Place
{
private:
   char name[20];
   int code;
public:
   void assign()
   {
       cout<<"Name:";
       gets(name);
       place.seekg(0,ios::beg);
       code=6000+(place.tellg()/sizeof(Place))+1;
   }
   int get_code()
   {
       return code;
   }
   void display()
   {
       puts(name);
       cout<<"("<<code<<")";
   }
};
class Date
{
private:
   int day;
   int month;
   int year;
public:
   void enter_date();
   void copy(Date d);
   void display()
   {
       cout<<day<<"."<<month<<"."<<year;
   }
   void refresh()
   {
       day=0;
       month=0;
       year=0;
   }
   int get_day()
   {
       return day;
   }
   int get_month()
   {
       return month;
   }
   int get_year()
   {
       return year;
   }
};
void Date::enter_date()
{
   int correct=0;
   do{
       cout<<"Day:";
       cin>>day;
       cout<<"Month:";
       cin>>month;
       cout<<"Year:";
       cin>>year;
       /* if((day>0)||(day<32)||(month>0)||(month<13)||(year>2009)||(year<2014))
       {
       if(((month==4)||(month==6)||(month==11)||(month==9))&&(day==31))
       {
       cout<<"Invalid date.
       Please re-enter correct date:
       ";
       continue;
       }
       else if((month==2)&&(day>28))
       {
       if((year==2012)&&(day==29))
       {
       cout<<"Date verified:Valid.
       ";
       correct=1;
       continue;
       }
       else
       {
       cout<<"Invalid date.
       Please re-enter corrcet date:
       ";
       continue;
       }
       }
       else
       {
       cout<<"Date verified:Valid.
       ";
       correct=1;
       continue;
       }
       }
       else
       {
       cout<<"Invalid date.
       Please re-enter correct date:
       ";
       continue;
       }
       */

       /*XXX part of the problem is that you have
       commented out the end of the loop, but have not commented out
       the start of the loop. I've restored the end of the loop for you here.
       */
   }while(correct==0);
}

void Date::copy(Date d)
{
   day=d.get_day();
   month=d.get_month();
   year=d.get_year();
}
Date date;

/*XXX you need to define Record before you use it in class Password
I have moved it up here for you.
*/
class Record
{
private:
   Date d;
   int code;
   int left;
public:
   int compare(Record r)
   {
       if((r.get_date().get_day()==d.get_day())&&(r.get_date().get_month()==d.get_month())&&(r.get_date().get_year()==d.get_year())&&(r.get_code()==code))
           return 1;
       else
           return 0;
   }
   void get(int a,int b)
   {
       code=a;
       d.copy(date);
       left=b;
   }
   void copy(Record r)
   {
       d.copy(r.get_date());
       code=r.get_code();
       left=r.get_left();
   }
   Date get_date()
   {
       return d;
   }
   int get_code()
   {
       return code;
   }
   int get_left()
   {
       return left;
   }
};

class Password
{
private:
   char pass[20];
public:
   Password()
   {
       strcpy(pass,"9830182259");
   }
   void change_pass(Record r);
   int compare_pass(char p[20]);
};

void Password::change_pass(Record r) /*XXX change_pass takes a record according to your definition*/
{
   char new_pass[20];
   cout<<"Enter current password";
   gets(new_pass);
   if(compare_pass(new_pass))
   {
       cout<<"Enter new password";
       gets(new_pass);
       strcpy(pass,new_pass);
       cout<<"Password changed successfully";
   }
   else
       cout<<"Invalid password Access Denied!!";
}


int Password::compare_pass(char p[20])
{
   for(int i=0;i<20;i++)
   {
       if(pass[i]==p[i])
           continue;
       else
           return 0;
   }
   return 1;
}

/*XXX These 3 lines need to be in a function. They cannot be sitting at
the top level of the file */
/*
Password *p=new Password();
ofstream write_pass("Password.dat",ios::binary);
write_pass.write((char*)&p,sizeof(p));
*/

class Flight
{
private:
   int f_code;
   char op[20];
   int operator_code;
   Place from;
   Place to;
   int time;
   int time_code;
   int fare;
   int economy_seats;
   int business_seats;
public:
   void check_availability();

   void assign()
   {
       flight.seekg(0,ios::end);
       f_code=1000+(flight.tellg()/sizeof(Flight))+1;
       cout<<"Operator:";
       gets(op);
       cout<<"Deparure:";
       from.assign();
       cout<<"Arrival:";
       to.assign();
       cout<<"Departure time:";
       cin>>time;
       if(time>500 && time<=1200)
           time_code=1;
       else if(time>1200 && time<=1800)
           time_code=2;
       else if(time>1800 && time<=0)
           time_code=3;
       else
           time_code=4;
       cout<<"Fare: Rs.";
       cin>>fare;
       cout<<"Economy seats:";
       cin>>economy_seats;
       cout<<"Business seats:";
       cin>>business_seats;
   }
   int check(int k,int l)
   {
       if((k==from.get_code())&&(l==to.get_code()))
           return f_code;
       else
           return 0;
   }
   int get_code()
   {
       return f_code;
   }
   int get_time_code()
   {
       return time_code;
   }
   int get_fare()
   {
       return fare;
   }
   void short_display()
   {
       cout<<"Flight code:"<<f_code<<" ";
       puts(op);
   }
   void display()
   {
       cout<<"Flight code:"<<f_code<<" ";
       puts(op);
       cout<<"From:";
       from.display();
       cout<<"To:";
       to.display();
       cout<<"Date:";
       date.display();
       cout<<"Time:"<<time<<"Fare:Rs.";
       f=fare*adults*1.0+fare*children*0.5+fare*infants*0.1;
       cout<<f<<endl;
   }
};
void Flight::check_availability(Record r)
{
   Record rec;
   r.get(f_code,economy_seats+business_seats);
   read_record.seekg(0,ios::beg);
   while(read_record)
   {
       read_record.read((char*)& rec, sizeof(rec));
       if(rec.compare(r))
       {
           r.copy(rec);
           break;
       }
   }
}
class Hotel
{
private:
   int h_code;
   char name[20];
   int star;
   Place p;
   int rooms;
   int avg_daily_rate;
   int xtra_perday;
   char amenities[200];
public:
   void check_availability(Record r);
   void assign()
   {
       hotel.seekg(0,ios::end);
       h_code=2000+(hotel.tellg()/sizeof(Hotel))+1;
       cout<<"Name:";
       gets(name);
       cout<<"Star rating:";
       cin>>star;
       cout<<"Location:";
       p.assign();
       cout<<"Number of Rooms:";
       cin>>rooms;
       cout<<"Average daily rate: Rs.";
       cin>>avg_daily_rate;
       cout<<"Extra per day:Rs:";
       cin>>xtra_perday;
       cout<<"Amenities:";
       gets(amenities);
   }
   void short_display()
   {
       puts(name);
       cout<<"("<<h_code<<") "<<star<<" star";
   }
   void display()
   {
       puts(name);
       cout<<"("<<h_code<<")"<<star<<" star"
           <<"Avg daily rate:Rs."<<avg_daily_rate;
       cout<<"Amenities:";
       puts(amenities);
       cout<<endl;
   }
   int get_code()
   {
       return h_code;
   }
   int get_location()
   {
       return p.get_code();
   }
};
void Hotel::check_availability(Record r)
{
   Record rec;
   r.get(h_code,rooms);
   read_record.seekg(0,ios::beg);
   while(read_record)
   {
       read_record.read((char*)& rec, sizeof(rec));
       if(rec.compare(r))
       {
           r.copy(rec);
           break;
       }
   }
}
class Rail
{
private:
   int r_code;
   char train[30];
   int seats;
   Place from;
   Place to;
   int time[10];
   Place stations[10];
   float fare[10];
public:
   void assign();
   void check_availability(Record r);
   int check(int x,int y);

   int get_code()
   {
       return r_code;
   }
   void short_display()
   {
       cout<<"Train code:"<<r_code<<" Name:";
       puts(train);
   }

};
void Rail::assign()
{
   rail.seekg(0,ios::end);
   r_code=3000+(rail.tellg()/sizeof(Rail))+1;
   cout<<"Train name:";
   gets(train);
   cout<<"Enter number of seats:";
   cin>>seats;
   cout<<"Starting location:";
   from.assign();
   cout<<"Destination station:";
   to.assign();
   cout<<"Enter stoppages:";
   for(int i=0;i<10;i++)
   {
       cout<<"Station "<<(i+1);
       stations[i].assign();
       cout<<"Time:";
       cin>>time[i];
       cout<<"Fare from previous station: Rs.";
       cin>>fare[i];
   }
}
int Rail::check(int x,int y)
{
   int result=0;
   int d=0;
   if(x==from.get_code())
       result=1;
   else
   {
       for(d=0;d<10;d++)
       {
           if(x==stations[d].get_code())
               result=1;
       }
   }
   if(result)
   {
       result=0;
       for(;d<10;d++)
       {
           if(y==stations[d].get_code())
               result=1;
       }
       if(!result)
       {
           if(y==to.get_code())
               result=1;
       }
   }
   if(result)
       return r_code;
   else
       return 0;
}
void Rail::check_availability(Record r)
{
   Record rec;
   r.get(r_code,seats);
   read_record.seekg(0,ios::beg);
   while(read_record)
   {
       read_record.read((char*)& rec, sizeof(rec));
       if(rec.compare(r))
       {
           r.copy(rec);
           break;
       }
   }
}
class Bus
{
private:
   int b_code;
   char op[20];
   int operator_code;
   Place from;
   Place to;
   Place stoppages[10];
   int time[10];
   float fare[10];
   int seats;
public:
   int check(int x,int y);
   void check_availability(Record r);
   void assign();
   int get_code()
   {
       return b_code;
   }
   void short_display()
   {
       cout<<"Bus code:"<<b_code<<" Operator:";
       puts(op);
   }
};
void Bus::assign()
{
   bus.seekg(0,ios::end);
   b_code=3000+(bus.tellg()/sizeof(Bus))+1;
   cout<<"Train name:";
   gets(op);
   cout<<"Enter number of seats:";
   cin>>seats;
   cout<<"Starting location:";
   from.assign();
   cout<<"Destination station:";
   to.assign();
   cout<<"Enter stoppages:";
   for(int i=0;i<10;i++)
   {
       cout<<"Station "<<i+1;
       stoppages[i].assign();
       cout<<"Time:";
       cin>>time[i];
       cout<<"Fare from previous station: Rs.";
       cin>>fare[i];
   }
}
int Bus::check(int x,int y)
{
   int result=0;
   int d=0;
   if(x==from.get_code())
       result=1;
   else
   {
       for(d=0;d<10;d++)
       {
           if(x==stoppages[d].get_code())
               result=1;
       }
   }
   if(result)
   {
       result=0;
       for(;d<10;d++)
       {
           if(y==stoppages[d].get_code())
               result=1;
       }
       if(!result)
       {
           if(y==to.get_code())
               result=1;
       }
   }
   if(result)
       return b_code;
   else
       return 0;
}
void Bus::check_availability(Record r)
{
   Record rec;
   r.get(b_code,seats);
   read_record.seekg(0,ios::beg);
   while(read_record)
   {
       read_record.read((char*)& rec, sizeof(rec));
       if(rec.compare(r))
       {
           r.copy(rec);
           break;
       }
   }
}
class Booked
{
private:
   int ref_no;
   int code;
   int l;
   int dest;
   char names[6][20];
   float fare;
   char credit_card[16];
   int conf;
   Date d;
   int preference;
   char e_mail[25];
public:
   void display();
   int confirm(int k, int l);
   int get_reference()
   {
       return ref_no;
   }
};
void Booked::display()
{
   cout<<"Reference No.:"<<ref_no<<endl;
   cout<<"Travellers:";
   for(int a=0;a<6;a++)
   {
       cout<<(a+1)<<". ";
       puts(names[a]);
   }
   cout<<"Total fare- Rs."<<fare;
   cout<<"Date:";
   d.display();
}
int Booked::confirm(int k, int l)
{
   l=leave;
   dest=destination;
   d.copy(date);
   preference=l;
   code=k;
   k=0;
   fare=f;
   cout<<"Please enter the names of the travellers(excluding infants):";
   cout<<"When done enter 0";
   do
   {
       gets(names[k]);
       k++;
   }while(names[k][0]!='0');
   booking.seekg(0,ios::end);
   ref_no=7000+(booking.tellg()/sizeof(Booked))+1;
   cout<<"Credit card number:";
   gets(credit_card);
   cout<<"e-mail id:";
   gets(e_mail);
   if(k-1!=0) conf=1;
   else conf=0;
   return conf;
}
class Holiday
{
private:
   Place leave;
   Place destination;
   char theme[20];
   int theme_code;
   int h_code;
   int duration;
   float fare;
   char description[300];
public:
   void assign()
   {
       holiday.seekg(0,ios::end);
       h_code=5000+(holiday.tellg()/sizeof(Holiday))+1;
       cout<<"Departure:";
       leave.assign();
       cout<<"Destination:";
       destination.assign();
       cout<<"Theme:";
       gets(theme);
       cout<<"Duration:";
       cin>> duration;
       cout<<"Fare: Rs.";
       cin>>fare;
       cout<<"Description:";
       gets(description);
   }
   void short_display()
   {
       cout<<"Destination:";
       p.display();
       cout<<" Code:"<<h_code;
       cout<<" Duration:"<<duration<<" days";
   }
   void display()
   {
       cout<<"Destination:";
       destination.display();
       cout<<"Flight will be provided from ";
       leave.display();
       cout<<"Holiday theme:";
       puts(theme);
       cout<<"Duration:"<<duration<<" days Fare: Rs."<<fare<<" per person Duration";
   }
};


void menu()
{
   cout<<"1. Flights"<<endl;
   cout<<"2. Hotels"<<endl;
   cout<<"3. Railways"<<endl;
   cout<<"4. Bus"<<endl;
   cout<<"5. Holidays"<<endl;
   cout<<"6. Check status"<<endl;
   cout<<"7. Login(for authorised personnel only)";
   cout<<"8. Exit";
}
void login_menu()
{
   cout<<"Login menu";
   cout<<"1. Add new flight";
   cout<<"2. Add new hotel";
   cout<<"3. Add new train";
   cout<<"4. Add new bus";
   cout<<"5. Add new holiday";
   cout<<"6. Add new place";
   cout<<"7. Change password";
   cout<<"8. Return to previous menu";
   cout<<"Enter your option(1-7):";
}
void display_cities()
{
   Place p;
   j=1;
   place.seekg(0);
   while(!place)
   {
       place.read((char*)& p, sizeof(Place));
       cout<<j<<".";
       p.display();
       cout<<endl;
       j++;
   }
   cout<<"Enter the city code:";
}
void read_info(int ch)
{
   if(ch!=2||ch!=5)
   {
       cout<<"Leaving from:";
       display_cities();
       cin>>leave;
   }
   cout<<"Going to:";
   display_cities();
   cin>>destination;
   if(ch!=2)
       cout<<"Departure date:";
   else
       cout<<"Arrival date:";
   date.enter_date();
   if(ch==1)
   {
       cout<<"Choose departure time\n"
           "1. 0500-1200\n"
           "2. 1200-1800\n"
           "3. 1800-0000\n"
           "4. 0000-0500\n";
       cin>>depart_time;
   }
   cout<<"Travellers(upto 6 per booking):";
   cout<<"Adults(12+):";
   cin>>adults;
   cout<<"Children(2-11):";
   cin>>children;
   cout<<"Infants(0-2):";
   cin>>infants;
}
void holiday_info()
{
   cout<<"Destination:";
   display_cities();
   cin>>destination;
   cout<<"Duration:\n"
       "1.1-4 days\n"
       "2.4-7 days\n"
       "3.7+ days\n";
   cin>>duration;
}
int search_flight()
{
   Flight f;
   int a1;
   int found=0;
   flight.seekg(0);
   cout<<"Search results:";
   while(flight)
   {
       flight.read((char*)& f, sizeof(Flight));
       if((f.check(leave,destination))&&(f.get_time_code()==depart_time))
       {
           f.short_display();
           found=1;
       }
   }
   if(found)
   {
       cout<<"Enter flight code to get more information:";
       cin>>a1;
       return a1;
   }
   else
       return 0;
}
int search_hotels()
{
   Hotel h;
   int a2;
   int found=0;
   while(hotel)
   {
       hotel.read((char*)& h, sizeof(Hotel));
       if(destination==h.get_location())
       {
           found=1;
           h.short_display();
       }
   }
   if(found)
   {
       cout<<"Enter hotel code to get more information:";
       cin>>a2;
       return a2;
   }
   else
       return 0;
}
int search_rails()
{
   Rail r;
   int a3;
   int found=0;
   rail.seekg(0);
   while(rail)
   {
       rail.read((char*)& r,sizeof(Rail));
       if(r.check(leave,destination))
       {
           found=1;
           r.short_display();
       }
   }
   if(found)
   {
       cout<<"Enter train code to get more information:";
       cin>>a3;
       return a3;
   }
   else
       return 0;
}

int search_buses()
{
   Bus b;
   int a4;
   int found=0;
   bus.seekg(0);
   while(bus)
   {
       bus.read((char*)& b,sizeof(Bus));
       if(b.check(leave,destination))
       {
           found=1;
           b.short_display();
       }
   }
   if(found)
   {
       cout<<"Enter bus code to get more information:";
       cin>>a4;
       return a4;
   }
   else
       return 0;
}
int search_holiday()
{
   Holiday h;
   int a5;
   int found=0;
   holiday.seekg(0);
   while(holiday)
   {
       holiday.read((char*)& h,sizeof(Holiday));
       if(h.get_destination()==destination)
       {
           found=1;
           h.short_display();
       }
   }
   if(found)
   {
       cout<<"Enter holiday code to get more information:";
       cin>>a5;
       return a5;
   }
   else
       return 0;
}
void refresh()
{
   leave=0;
   destination=0;
   date.refresh();
   depart_time=0;
   adults=0;
   children=0;
   infants=0;
   j=0;
   c=0;
   duration=0;
}
void book(int code, int choice)
{
   int check=0;
   char ch;
   Record r;
   Booked b;
   cout<<"You have selected the following ";
   switch(choice)
   {
   case 1: Flight f;
       flight.seekg(0,ios::beg);
       while(flight)
       {
           flight.read((char*)& f,sizeof(f));
           if(code==f.get_code())
               break;
       }
       cout<<"flight:";
       f.display();
       cout<<"Checking availability";
       f.check_availability(r);
       if(r.get_left()!=0)
       {
           cout<<"Seats available";
           check=1;
       }
       else
           cout<<"Sorry! Seats unavailable";
       break;
   case 2: Hotel h;
       hotel.seekg(0,ios::beg);
       while(hotel)
       {
           hotel.read((char*)& h,sizeof(h));
           if(code==h.get_code())
               break;
       }
       cout<<"hotel:";
       h.display();
       cout<<"Checking availability";
       h.check_availability(r);
       if(r.get_left()!=0)
       {
           cout<<"Seats available";
           check=1;
       }
       else
           cout<<"Sorry! Seats unavailable";
       break;
   case 3: Rail rl;
       rail.seekg(0,ios::beg);
       while(rail)
       {
           rail.read((char*)& f,sizeof(rl));
           if(code==rl.get_code())
               break;
       }
       cout<<"flight:";
       rl.display();
       cout<<"Checking availability";
       rl.check_availability(r);
       if(r.get_left()!=0)
       {
           cout<<"Seats available";
           check=1;
       }
       else
           cout<<"Sorry! Seats unavailable";
       break;
   case 4: Bus b;
       bus.seekg(0,ios::beg);
       while(bus)
       {
           bus.read((char*)& b,sizeof(b));
           if(code==b.get_code())
               break;
       }
       cout<<"bus:";
       b.display();
       cout<<"Checking availability";
       b.check_availability(r);
       if(r.get_left()!=0)
       {
           cout<<"Seats available";
           check=1;
       }
       else
           cout<<"Sorry! Seats unavailable";
       break;
   case 5: Holiday h;
       holiday.seekg(0,ios::beg);
       while(holiday)
       {
           holiday.read((char*)& h,sizeof(h));
           if(code==h.get_code())
               break;
       }
       cout<<"holiday:";
       h.display();
       cout<<"Checking availability";
       h.check_availability(r);
       if(r.get_left()!=0)
       {
           cout<<"Seats available";
           check=1;
       }
       else
           cout<<"Sorry! Seats unavailable";
       break;
   }
   if(check)
   {
       cout<<"Confirm this booking?(y/n):";
       cin>>ch;
       if((ch=='y')||(ch=='Y'))
           check=b.confirm(code,choice);
       if(check)
       {
           r.update();
           cout<<"Your booking has been confirmed."
               "Ypur reference number is:"<<b.get_reference();
           book.write((char*)& b,sizf(b));
           write_record.seekp(read_record.tellg()-sizeof(r),ios::beg);
           write_record.write((char*)& r,sizeof(r));
       }
       else
           cout<<"Unable to confirm booking,";
   }
}
void check_status()
{
   cout<<"Reference number:";
   int n;
   cin>>n;
   Booked b;
   booking.seekg(0,ios::beg);
   while(booking)
   {
       booking.read((char*)& b,sizeof(b));
       if(n==b.get_reference())
       {
           b.display();
           break;
       }
       else
           n=0;
   }
   if(!n)
       cout<<"Invalid reference number. Please make sure that the number you have entered is correct.";
}
void login()
{
   ofstream get_flight("Flights.dat",ios::binary,ios::app);
   ofstream get_hotel("Hotel.dat",ios::binary,ios::app);
   ofstream get_rail("Rails.dat",ios::binary,ios::app);
   ofstream get_bus("Bus.dat",ios::binary,ios::app);
   ofstream get_holiday("Holiday.dat",ios::binary,ios::app);
   ofstream get_place("Places.dat",ios::binary,ios::app);
   ifstream read_pass("Password.dat",ios::binary);
   int choice;
   char pass[20];
   Password p;
   read_pass.read((char*)& p,sizeof(p));
   cout<<"Password:";
   gets(pass);
   if(p.compare_pass(pass))
   {
       do
       {
           login_menu();
           cin>>choice;
           switch(choice)
           {
           case 1: Flight f;
               f.assign();
               get_flight.write((char*)& f,sizeof(f));
               break;
           case 2: Hotel h;
               h.assign();
               get_hotel.write((char*)& h,sizeof(h));
               break;
           case 3: Rail r;
               r.assign();
               get_rail.write((char*)& r,sizeof(r));
               break;
           case 4: Bus b;
               b.assign();
               get_bus.write((char*)& b,sizeof(b));
               break;
           case 5: Holiday h;
               h.assign();
               get_holiday.write((char*)& h,sizeof(h));
               break;
           case 6: Place p;
               p.assign();
               get_place.write((chr*)& p,sizeof(p));
               break;
           case 7: cout<<"Password:";
               p.change_pass();
               write_pass.write((char*)& p,sizeof(p));
               break;
           case 8: cout<<"Exiting...";
               break;
           default:cout<<"Invalid option. Access denied.";
           }
       }while(choice!=7);
   }
   else
       cout<<"Invalid password!! Access denied...";
}

void main()
{
   cout<<"Welcome to KHK Travel Agency"<<endl;
   int choice;
   do{
       menu();
       cout<<"Enter your option:"<<endl;
       cin>>choice;
       switch(choice)
       {
       case 1: cout<<"Booking Flights";
           read_info(choice);
           if(c=search_flight())
           {
               book(c,choice);
           }
           else
           {
               cout<<"Sorry.There does not exist any flight between the destinations you entered.";
           }
           refresh();
           break;
       case 2: cout<<"Booking Hotels";
           read_info(choice);
           if(c=search_hotels())
           {
               book(c,choice);
           }
           else
           {
               cout<<"Sorry.There does not exist any hotel under our network in the place specified by you.";
           }
           refresh();
           break;
       case 3: cout<<"Online Railway Reservation";
           read_info(choice);
           if(c=search_rails())
           {
               book(c,choice);
           }
           else
           {
               cout<<"Sorry.No train routes exist between the stations you entered.";
           }
           refresh();
           break;
       case 4: cout<<"Online Bus Seats Booking";
           read_info(choice);
           if(c=search_buses())
           {
               book(c,choice);
           }
           else
           {
               cout<<"Sorry.No bus routes exist between the places you entered.";
           }
           refresh();
           break;
       case 5: cout<<"Planning Holidays";
           holiday_info();
           if(c=search_holidays())
           {
               book(c,choice);
           }
           else
           {
               cout<<"Sorry.Our travel agency does not arrange holidays in the city you entered.";
           }
           refresh();
           break;
       case 6: check_status();
           break;
       case 7: login();
           break;
       case 8: cout<<"Thank You for using KHK Travel Agency.Please visit again.";
           break;
       default: cout<<"Invalid input!!Please enter your option again.";
       }
   }while(choice!=7);
}

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Zlatko

Expertise

No longer taking questions.

Experience

No longer taking questions.

Education/Credentials
No longer taking questions.

©2012 About.com, a part of The New York Times Company. All rights reserved.