Question

Create a cpp file that contains a constructor and destructor of a node in a circular...

Create a cpp file that contains a constructor and destructor of a node in a circular doubly-linked list using the following header file:

class CDLLNode {
private:
// these will contain the timestamp and content of the tweet as strings
std::string time;
std::string tweet;

// these are pointers to the next and previous nodes in the CDLL
CDLLNode *next;
CDLLNode *prev;

public:
CDLLNode(const char *ti, const char *tw);
~CDLLNode();

friend class CDLL;
};

0 0
Add a comment Improve this question Transcribed image text
Answer #1


#include "CDLLNODE.H"
CDLLNode :: CDLLNode(const char *ti,const char *tw){
   time=str(ti);
   tweet=str(tw);

}
CDLLNode :: ~CDLLNode(){
   delete(next);
   delete(prev);
}

Note : If you like my answer please rate and help me it is very Imp for me

Add a comment
Know the answer?
Add Answer to:
Create a cpp file that contains a constructor and destructor of a node in a circular...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • // Header code for stack // requesting to create source code using C++ #ifndef Stack_h #define...

    // Header code for stack // requesting to create source code using C++ #ifndef Stack_h #define Stack_h #include <stdio.h> #include <string> #include <iostream> using namespace std; class Stack { public: Stack(); ~Stack(); bool empty(); string top(); void push(const string &val); void pop(); void display(ostream &out); private: class Node { public: string word; Node *next; }; Node *tos; }; #endif Header file provided above. PLS create source code for functions declared in the header. If changes are need no make in...

  • implement a doubly-linked list in C. Each node in the linked list should contain a string,...

    implement a doubly-linked list in C. Each node in the linked list should contain a string, a pointer to the previous node (or NULL), and a pointer to the next node (or NULL). The nodes should be sorted by their strings. struct node_t { char* str; struct node_t* prev; struct node_t* next; } To maintain the doubly-linked list, you should keep a pointer to the head node of the list (or NULL if the list is empty), and a pointer...

  • Please write a c++ header file, class implementation file and main file that does all of...

    Please write a c++ header file, class implementation file and main file that does all of the following and meets the requirements listed below. Also include a Output of your code as to show that your program works and functions properly. EXERCISING A DOUBLY-LINKED LIST CLASS This project consists of two parts, the second of which appears below. For the first part, write a class that implements an unordered list abstract data type using a doubly-linked list with pointers to...

  • Problem 3 will have the following class Node. static class Node { public char data; public...

    Problem 3 will have the following class Node. static class Node { public char data; public Node next; public Node previous; }; 3. Answer all the sub-questions but for the following circular doubly-linked list with the external reference P2 given in the below figure, write the statements of each following question. You can only use pointer P2 to access the doubly-linked list, write program statements to do the following, each question is independent based on the original status. 1) Display...

  • v. 15 points) implementing data structure operations C++ code for a new public member function to...

    v. 15 points) implementing data structure operations C++ code for a new public member function to be added to the doubly linked list data structure used in class. Return the average value of all elements in the list ple a list of integers) Throws a length error exception if the list is empty. template «typename E> E& 0; average You may use loops or recursion as needed. If necessary, you may add private helper function0s) The definition of the DLinkedList...

  • please write the code in C++ 2 Base class File 3 Derived class PDF 3.1 Class...

    please write the code in C++ 2 Base class File 3 Derived class PDF 3.1 Class declaration • The class PDF inherits from File and is a non-abstract class 1. Hence objects of the class PDF can be instantiated. 2. To do so, we must override the pure virtual function clone) in the base class • The class declaration is given below. • The complete class declaration is given below, copy and paste it into your file. . It is...

  • Implement an AVL tree stored in a random access file Each node contains an integer key,...

    Implement an AVL tree stored in a random access file Each node contains an integer key, one or more fixed length character strings, a left child reference, a right child reference and a height The format of the file is shown on the next slide The methods you must implement are shown on the followingslides. Duplicate keys cannot be entered in the tree Your implementation MUST NOT load the whole tree in memory. Each operation only makes copies of the...

  • Create an h file called list. It should have the following features: lisi's funnc In no particular order: List(): Default constructor. This should construct an empty List, the member variables sh...

    Create an h file called list. It should have the following features: lisi's funnc In no particular order: List(): Default constructor. This should construct an empty List, the member variables should be initialized to reflect this state. This function is already fully implemented. 1. List(const List<Type>& other): Copy constructor for the linked list. This should create an entirely new linked list with the same number of Nodes and the Values stored these Nodes in the same order as seen the...

  • For the LinkedList class, create a getter and setter for the private member 'name', constructing your...

    For the LinkedList class, create a getter and setter for the private member 'name', constructing your definitions based upon the following declarations respectively: std::string get_name() const; and void set_name(std::string); In the Main.cpp file, let's test your getter and setter for the LinkedLIst private member 'name'. In the main function, add the following lines of code: cout << ll.get_name() << endl; ll.make_test_list(); ll.set_name("My List"); cout << ll.get_name() << endl; Output should be: Test List My List Compile and run your code;...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT