Kwwiker

StackOnList.h

Apr 14th, 2021
626
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ifndef __STACKONLIST_H
  2. #define __STACKONLIST_H
  3. using namespace std;
  4.  
  5. class StackOnList {
  6. public:
  7.     void push(int elem);
  8.     void pop();
  9.     int peek();
  10.     int getQuantity();
  11.     bool isEmpty();
  12.     void makeEmpty();
  13. private:
  14.     int m_quantity = 0;
  15.     struct Node
  16.     {
  17.         int info;
  18.         Node* next;
  19.     };
  20.     Node* head = nullptr;
  21. };
  22.  
  23. #endif
  24.  
RAW Paste Data