Flights001
Home ] Up ]

 

//file   Flights001.cpp
//date   11/29/2006
//author aou
//csis250.tripod.com

// Flights and Flights

///////////////////////////////////////////////////////////
//includes
///////////////////////////////////////////////////////////
#include <iostream>
using namespace std;


const int TEST_COUNT = 5;
const int MAX_CHARS = 30;


class CFlight
  {
  private:
    char orig[MAX_CHARS];
    char dest[MAX_CHARS];
    int  cost;
    CFlight *next;
  public:
    CFlight(void);
    CFlight(char orig[], char dest[], int cost);
    friend class CFlights;   
    friend ostream & operator << (ostream & bob, const CFlight &flight);
  };


class CFlights
  {
  private:
    int count;
    CFlight *first;
    CFlight *last;
  public:
    CFlights(void);
    CFlights(int n);
    CFlights(char ch);
    bool add(char orig[], char dest[], int cost);
    CFlight * findFlight(char orig[], char dest[]);
    CFlights * findFlights(char orig[], char dest[]);
    CFlight * findCheapestFlight(char orig[], char dest[]);
    CFlights * findFlightsOrderedByCost(char orig[], char dest[]);

    friend ostream & operator << (ostream & bob, const CFlights &flights);
  };