#include "itemtype.h" // typedef for ItemType #ifndef NULL // If NULL is not yet defined #define NULL 0 // define it #endif // The bool's that are returned by the methods take value 1 if the // method succeeds and 0 otherwise (if there is overflow, underflow, etc.) struct OrderedListNode { ItemType item; OrderedListNode * next; OrderedListNode(); OrderedListNode(ItemType newitem, OrderedListNode * newnext); }; class OrderedList { public: OrderedList(); ~OrderedList(); bool Init(); //(re-)Initializes the ordered list by emptying it bool IsEmpty() const; //tests if ordered list is empty bool IsFull() const; //tests if ordered list is full bool Insert(ItemType item); //inserts item in order into the list bool Remove(ItemType item); //removes the item from the list if it exists; //returns false if it doesn't bool Smallest(ItemType &item) const; //gives the smallest item in the list //does not change the list itself void Print(); private: OrderedListNode * list; //the linked list of items, smallest to largest };