Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help this is C++ Given two int parameters, value1 and value2, insert a new node, storing value1, before the node that stores value2. Given

please help this is C++

  1. Given two int parameters, value1 and value2, insert a new node, storing value1, before the node that stores value2.
  2. Given two int parameters, value1 and value2, insert a new node, storing value1, after the node that stores value2.

#include #include // Need to include for nullptr.

class Node { public: Node() : data(0), next(nullptr) {} Node(int theData, Node *newNext) : data(theData), next(newNext){} Node* getNext() const { return next; } int getData( ) const { return data; } void setData(int theData) { data = theData; } void setNext(Node *newNext) { next = newNext; } ~Node(){} private: int data; Node *next; // Pointer that points to next node. };

class AnyList { public: AnyList() : first(nullptr), count(0) {}

//add functions here

void clearList(); ~AnyList();

private: Node *first; // Pointer to point to the first node in the list. int count; // Variable to keep track of number of nodes in the list. };

#endif

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Database Development

Authors: Al Stevens

1st Edition

1558283579, 978-1558283572

More Books

Students also viewed these Databases questions

Question

5. What information would the team members need?

Answered: 1 week ago

Question

Which team solution is more likely to be pursued and why?

Answered: 1 week ago