Phr0zen_Penguin

SortedList.h - VTC C++ Data Structures Header File

Apr 6th, 2015
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.55 KB | None | 0 0
  1. /**
  2.  * [SortedList.h]
  3.  * The SortedList class declaration/specification.
  4.  */
  5.  
  6. #ifndef SORTEDLIST_H
  7. #define SORTEDLIST_H
  8.  
  9. #include <iostream>
  10.  
  11. const   int MAX_LENGTH_Sorted_List = 100;       // the maximum length of the list
  12.  
  13. class SortedList
  14. {
  15.     /**
  16.      * Everything under public can be accessed by all other programs or classes.
  17.      */
  18.     public:
  19.         /**
  20.          * Constructor(s):
  21.          */
  22.         SortedList();
  23.  
  24.         /**
  25.          * Mutators:
  26.          */
  27.         void InsertItem(float);
  28.         void DeleteItem(float);
  29.  
  30.         /**
  31.          * Accessors:
  32.          */
  33.         float GetNextItem();
  34.         float GetPrevItem();
  35.         float RetrieveItem(int);
  36.  
  37.         /**
  38.          * General Use:
  39.          */
  40.         bool IsEmpty();             // returns true if the list is empty
  41.         bool IsFull();              // returns true if the list is full
  42.         void ResetList();           // resets the list (brings the current position back the the beginning)
  43.         int LengthIs();             // returns the length of the list
  44.         bool IsInTheList(float);    // returns true if the provided item is in the list
  45.         void Print();
  46.  
  47.  
  48.     /**
  49.      * Everything under protected can be accessed only by the class itself or (derived) subclasses,
  50.      * as in the case of inheritance.
  51.      */
  52.     protected:
  53.  
  54.  
  55.     /**
  56.      * (Private) DATA MEMBERS/PROPERTIES:
  57.      *
  58.      * Everything under private can only be accessed by the class itself (the code in the
  59.      * implementation file).
  60.      */
  61.     private:
  62.         int     length;                         // the length of the list
  63.         int     currentPos;                     // the current position of the list
  64.         float   data[MAX_LENGTH_Sorted_List];   // stores the data members of the list
  65. };
  66.  
  67. #endif // SORTEDLIST_H
Advertisement
Add Comment
Please, Sign In to add comment