Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * [SortedList.h]
- * The SortedList class declaration/specification.
- */
- #ifndef SORTEDLIST_H
- #define SORTEDLIST_H
- #include <iostream>
- const int MAX_LENGTH_Sorted_List = 100; // the maximum length of the list
- class SortedList
- {
- /**
- * Everything under public can be accessed by all other programs or classes.
- */
- public:
- /**
- * Constructor(s):
- */
- SortedList();
- /**
- * Mutators:
- */
- void InsertItem(float);
- void DeleteItem(float);
- /**
- * Accessors:
- */
- float GetNextItem();
- float GetPrevItem();
- float RetrieveItem(int);
- /**
- * General Use:
- */
- bool IsEmpty(); // returns true if the list is empty
- bool IsFull(); // returns true if the list is full
- void ResetList(); // resets the list (brings the current position back the the beginning)
- int LengthIs(); // returns the length of the list
- bool IsInTheList(float); // returns true if the provided item is in the list
- void Print();
- /**
- * Everything under protected can be accessed only by the class itself or (derived) subclasses,
- * as in the case of inheritance.
- */
- protected:
- /**
- * (Private) DATA MEMBERS/PROPERTIES:
- *
- * Everything under private can only be accessed by the class itself (the code in the
- * implementation file).
- */
- private:
- int length; // the length of the list
- int currentPos; // the current position of the list
- float data[MAX_LENGTH_Sorted_List]; // stores the data members of the list
- };
- #endif // SORTEDLIST_H
Advertisement
Add Comment
Please, Sign In to add comment