Question
PARAMETERS: An array and the number of elements in the array 1.Given an empty calling object, copy one or more elements of the array into
PARAMETERS: An array and the number of elements in the array
1.Given an empty calling object, copy one or more elements of the array into the calling object.
2.Given an empty calling object, copy in reverse one or more elements of the array into the calling object.
3.Given an empty calling object, copy specific elements (even, odds, multiples, etc.) of the array into the calling object.
4. Given an empty array, copy specific elements (even, odds, multiples, etc.) of the calling object into the array.
5. Given an empty array, copy in reverse one or more elements of the calling object into the array.
6. Given an empty array, copy specific elements (even, odds, multiples, etc.) of the calling object into the array.
7. Compare the elements of the calling object and the array and return true if they are the same (make sure to first check if the number of elements is the same, because there is no need to start a loop if the number of elements differs).
please help me with these problems for C++ thank you so much
and here is the .h file
#include
class Node { public: Node() : data(0), prev(nullptr), next(nullptr) {} Node(int theData, Node* prevLink, Node* nextLink) : data(theData), prev(prevLink), next(nextLink) {} int getData() const { return data; } Node* getPrev() const { return prev; } Node* getNext() const { return next; } void setData(int theData) { data = theData; } void setPrev(Node* prevLink) { prev = prevLink; } void setNext(Node* nextLink) { next = nextLink; } ~Node(){} private: int data; // To simplify, we are using only one piece of data. Node* prev; Node* next; };
class DoublyList { public: DoublyList() : first(nullptr), last(nullptr), count(0) {} ~DoublyList();
private: // Pointer to the first node on the list. Node *first; // Pointer to the last node on the list. Node *last; // Number of nodes in the list. int count; };
#endif
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started