Question: where is the errors? #include #include #include #include using namespace std; //Global variables const int size=100; // Number of rooms (size of room array) int
where is the errors?
#include
#include
#include
#include
using namespace std;
//Global variables
const int size=100; // Number of rooms (size of room array)
int count=0;
//Structures Declaration
struct date{
int day;
int month;
int year;
};
struct reserv_info{
string name;
string pho_num;
int no_room; // room number
int no_resroom; // number of rooms
char roomtyp;
date checkin;
date checkout;
int no_days;
} room[size];
//Functions Prototypes
void readData(reserv_info arr[]);
// void writeData(reserv_info arr[], int count);
int menu();
void add_reserv(reserv_info a[],int &count);
void delete_reserv(reserv_info arr[] ,int &count);
void update_reserv(int count);
void sort_reserv(int count);
bool emptyArray (int count);
int search(int count); //search by phone number.
void show_reserv(int i);
void print_reserv(int count);
void app_reserv(reserv_info arr[], int count);
// void copyfile(reserv_info arr[], int count);
//Functions Definition:
void readData(reserv_info room[]){
string line;
ifstream iFile("hotel.txt",ios::in);
ofstream oFile("hotel.txt",ios::app);
if(oFile.is_open() && iFile.is_open()){
oFile<<"Data of the Guste: "<
while(!iFile.eof()){
iFile >> room[count].name;
iFile >> room[count].pho_num;
iFile >> room[count].no_room;
iFile >> room[count].no_resroom;
iFile >> room[count].roomtyp;
iFile >> room[count].checkin.day;
iFile >> room[count].checkin.month;
iFile >> room[count].checkin.year;
iFile >> room[count].checkout.day;
iFile >> room[count].checkout.month;
iFile >> room[count].checkout.year;
iFile >> room[count].no_days;
count++;
for(int i=0;count
oFile<<"Guste "<
oFile << room[count].name<<"\t";
oFile << room[count].pho_num<<"\t";
oFile << room[count].no_resroom<<"\t";
oFile << room[count].roomtyp<<"\t(";
oFile << room[count].checkin.day<<"/";
oFile << room[count].checkin.month<<"/";
oFile << room[count].checkin.year<<")\t(";
oFile << room[count].checkout.day<<"/";
oFile << room[count].checkout.month<<"/";
oFile << room[count].checkin.year<<")\t";
oFile << room[count].no_days<<" "<<"__________________ ";
oFile<
}
getline(iFile,line); // read from original file
oFile<< line << endl; // write to backup file
oFile.close();iFile.close();}
}
else
cout<<"The File didn't open!. ";
}
//void writeData(reserv_info a[], int count){
// ofstream oFile("hotel.txt",ios::app);
// if(oFile.is_open()==true){
// oFile<<"Data of the Guste: "<
// while(!oFile.eof()){
// for(int i=0;i
// oFile<<"Guste "<
// oFile << a[i].name<<"\t";
// oFile << a[i].pho_num<<"\t";
// oFile << a[i].no_resroom<<"\t";
// oFile << a[i].roomtyp<<"\t(";
// oFile << a[i].checkin.day<<"/";
// oFile << a[i].checkin.month<<"/";
// oFile << a[i].checkin.year<<")\t(";
// oFile << a[i].checkout.day<<"/";
// oFile << a[i].checkout.month<<"/";
// oFile << a[i].checkin.year<<")\t";
// oFile << a[i].no_days<<" "<<"__________________ ";
// oFile<
// }
// oFile.close();}
// }
//
//cout<<"The File didn't open!. ";
//}
//void copyfile(reserv_info a[], int count){
// ofstream oFile("read_hotel.txt",ios::out);
// ifstream iFile("write_hotel.txt",ios::in);
// if(oFile.is_open()==true && iFile.is_open()==true){
// for(int i=0;i
// while (!iFile.eof()){
// getline(iFile,a[i].name);
// oFile<
// getline(iFile,a[i].pho_num);
