void Admin::searchFlight(string destination)
{
int day, month, year, min, hour,flightID;
string departure;
double price;
Flight sFlight;
string read;
Date dateOfFlight(day,month,year);
Time timeOfFlight(min,hour);
ifstream inFlight("Flight.txt");
while(!inFlight.eof())
{
inFlight.getline(read,departure);
}
int counter = 0;
for(int i = 0; i<flightList.size();i++)
{
if(destination.compare(flightList[i].getDestination()))
{
//counter++;
flightList[i].displayFlightSchedule();
}
}
}
之间有错误inFlight.getline(read,departure);
。由于我的文件有这种类型的详细信息
(航班号:1 出发地:马来西亚 目的地:英国 本次航班价格:RM20000 航班日期:24/12/1993 航班时间:12:12)
我想在执行此代码时将它们读出来admin.searchFlight("UK");