Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help with 6 of the functions from c++ and the PARAMETER: (An int or more storing values.) Delete the last node of the

i need help with 6 of the functions from c++ and the PARAMETER: (An int or more storing values.)

  1. Delete the last node of the calling object.
  2. Delete the node before-last of the calling object.
  3. Replace the value of the first node of the calling object with the value passed by the parameter.
  4. Replace the value of the last node of the calling object with the value passed by the parameter.
  5. Replace the value of the second node of the calling object with the value passed by the parameter.
  6. Replace the value of the second-to-last node of the calling object with the value passed by the parameter.

++++++++++++++++++++++++++++++++++++++

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) {}

void print() const;

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

thank you so much

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

Handbook Of Database Security Applications And Trends

Authors: Michael Gertz, Sushil Jajodia

1st Edition

1441943056, 978-1441943057

More Books

Students also viewed these Databases questions