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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
|
fstream f2;
for(int i=0;i<7;i++) //To determine the day of the flight
{
if(i==0) //searches through the flight records of eact day to
{ //see if the flight is on the perticular day
f2.open("Flight_RecordSunday.dat",ios::in|ios::binary);
while(f2.read((char*)&f,sizeof(f)))
if(!strncmp(code,f.retcode(),sizeof(f.retcode())))
{
strcpy(day,"SUNDAY");
return true;
}
}
if(i==1)
{
f2.open("Flight_RecordMonday.dat",ios::in|ios::binary);
while(f2.read((char*)&f,sizeof(f)))
if(!strncmp(code,f.retcode(),sizeof(f.retcode())))
{
strcpy(day,"MONDAY");
return true;
}
}
if(i==2)
{
f2.open("Flight_RecordTuesday.dat",ios::in|ios::binary);
while(f2.read((char*)&f,sizeof(f)))
if(!strncmp(code,f.retcode(),sizeof(f.retcode())))
{
strcpy(day,"TUESDAY");
return true;
}
}
if(i==3)
{
f2.open("Flight_RecordWednesday.dat",ios::in|ios::binary);
while(f2.read((char*)&f,sizeof(f)))
if(!strncmp(code,f.retcode(),sizeof(f.retcode())))
{
strcpy(day,"WEDNESDAY");
return true;
}
}
if(i==4)
{
f2.open("Flight_RecordThursday.dat",ios::in|ios::binary);
while(f2.read((char*)&f,sizeof(f)))
if(!strncmp(code,f.retcode(),sizeof(f.retcode())))
{
strcpy(day,"THURSDAY");
return true;
}
}
if(i==5)
{
f2.open("Flight_RecordFriday.dat",ios::in|ios::binary);
while(f2.read((char*)&f,sizeof(f)))
if(!strncmp(code,f.retcode(),sizeof(f.retcode())))
{
strcpy(day,"FRIDAY");
return true;
}
}
if(i==6)
{
f2.open("Flight_RecordSaturday.dat",ios::in|ios::binary);
while(f2.read((char*)&f,sizeof(f)))
if(!strncmp(code,f.retcode(),sizeof(f.retcode())))
{
strcpy(day,"SATURDAY");
return true;
}
}
f2.close();
}
|