Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int searchFlights(int flightIdx[],
- Flight flights[], int nFlights,
- const string & orig, const string & dest)
- {
- int j = 0;
- for (int i=0; i<nFlights; i++)
- {
- if (flights[i].get_orig() == orig && flights[i].get_dest() == $
- {
- flightIdx[j] = i;
- j++;
- }
- }
- return j;
- }
- ////////////////////////////////////////
- // 'searchFlight' searches for flight given 'airline' and 'flightNum'
- // in array 'flights' with 'nFlights' flights
- // return index into 'flights' of matching flight
- // or -1 if not found
- int searchFlight(Flight flights[], int nFlights,
- const string & airline, int flightNum)
- {
- for (int i=0; i<nFlights; i++)
- {
- if (flights[i].get_airline() == airline && flights[i].get_fligh$
- return i;
- else
- return -1;
- }
- }
Add Comment
Please, Sign In to add comment