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 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
class bookingclass // New Class called Booking
{
public:
string time;
string date;
string id;
string timestart;
string timeend;
string roomid;
string organizer;
string num_participate;
};
//========================================================================================
class allbooking : public include_function
{
public:
vector <bookingclass> booking;
allbooking()
{
ifstream fin ("booking.dat"); //loading.............(database)
int c1=0;
char d1=200, d2=201;
string datarow = read_input("booking.dat",c1,d2);
while (datarow!="")
{
booking.resize(booking.size()+1);
booking[c1].time=get_data(datarow,d1,1);
booking[c1].date=get_data(datarow,d1,2);
booking[c1].id=get_data(datarow,d1,3);
booking[c1].timestart=get_data(datarow,d1,4);
booking[c1].timeend=get_data(datarow,d1,5);
booking[c1].roomid=get_data(datarow,d1,6);
booking[c1].organizer=get_data(datarow,d1,7);
booking[c1].num_participate=get_data(datarow,d1,8);
c1++;
datarow = read_input("booking.dat",c1,d2);
}
};
void save_allbooking() // Save All Booking Function
{
int c=0; //counter
char d1=200, d2=201;
ofstream fout ("booking.dat");
cout << setw (58) << "=====================================" << endl;
cout << setw (58) << " SAVE ALL BOOKING RECORD " << endl;
cout << setw (58) << "=====================================" << endl;
cout<< endl;
while ((c < booking.size()))
{
fout << booking[c].time << d1 << booking[c].date << d1 << booking[c].id << d1 << booking[c].timestart << d1
<< booking[c].timeend << d1 << booking[c].roomid << d1 << booking[c].organizer << d1<< booking[c].num_participate << d2;
cout << endl;
c++;
}
};
|