// implement queues with simple arrays // requires // QTYPE be defined (or defaults to int) // cout << QTYPE be defined #ifndef QTYPE #define QTYPE int int shorter( int x, int y){ return xy; } #else extern int shorter(QTYPE, QTYPE); extern int higherPri(QTYPE, QTYPE); #endif // remove comment to run test //#define ISTEST #include #include class Queue { public: Queue(int); Queue() {}; int insert(QTYPE); QTYPE remove(); QTYPE peek(); int empty() {return neles==0;}; int full() {return neles==max; } void print(); void clear() { neles=front=back=0; } QTYPE shortest(); QTYPE highestPri(); private: void pack(); int max, neles, front, back; QTYPE * eles; }; #include "queue.cpp"