-
Notifications
You must be signed in to change notification settings - Fork 1
/
booking.h
47 lines (45 loc) · 1.07 KB
/
booking.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include<fstream>
using namespace std;
//Structure variables for booking
struct Booking
{
string booking_id;
string guest_name;
string address;
string phone;
string from_date;
string to_date;
};
//booking function
void booking()
{
//creating file to store data
ofstream file("Booking.txt",ios::app);
Booking b;
char ch;
//while loop saving data
do
{
if(file)
{
cout<<"Enter the booking id!"<<endl;
cin>>b.booking_id;
cout<<"Enter guest name!"<<endl;
cin>>b.guest_name;
cout<<"Enter address of guest!"<<endl;
cin>>b.address;
cout<<"Enter phone number of the guest!"<<endl;
cin>>b.phone;
cout<<"Enter the booking date!"<<endl;
cin>>b.from_date;
cout<<"Enter the leaving date!"<<endl;
cin>>b.to_date;
cout<<endl;
//storing data in the file
file<<b.booking_id<<"\t"<<b.guest_name<<"\t"<<b.address<<"\t"<<b.phone<<"\t"<<b.from_date<<"\t"<<b.to_date<<endl;
}
//for terminating loop
cout<<"Enter y if you want another booking!"<<endl;
cin>>ch;
}while(ch=='y' || ch=='Y');
}