Advertisement
bwukki

Untitled

May 24th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5.  
  6. class Node {
  7. public:
  8.     Node(int _data)
  9.     : data{_data}, prev{this}, next{this}
  10.     {}
  11.  
  12.     Node* getNext() const {
  13.         return next;
  14.     }
  15.  
  16. private:
  17.     Node* prev;
  18.     int data;
  19.     Node* next;
  20. };
  21.  
  22. class DLinkedCircList {
  23. public:
  24.     DLinkedCircList()
  25.     : head{nullptr}, size{0} {
  26.  
  27.     }
  28.  
  29.     void push_back(int input) {
  30.         Node* nodePtr{new Node{input}};
  31.         //did the memory get allocated???
  32.         if (head == nullptr) {
  33.             head = nodePtr;
  34.         }
  35.         else { //add to end
  36.         }
  37.         size +=1;
  38.     }
  39. private:
  40.     Node* head;
  41.     int size;
  42.  
  43. };
  44.  
  45. int main()
  46. {
  47.     DLinkedCircList testList{};
  48.     cout << "Hello world!" << endl;
  49.     return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement