Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please help me with these functions from c++ Given two int parameters, oldValue and newValue, replace the first occurrence of the oldValue with the newValue.

please help me with these functions from c++

  1. Given two int parameters, oldValue and newValue, replace the first occurrence of the oldValue with the newValue.
  2. Given two int parameters, oldValue and newValue, replace all occurrences of the oldValue with the newValue.
  3. Traverse the calling object and search for the value passed by the parameter; return true if found and false if not found. Make sure you stop the loop if the value is found; no need to keep on iterating.

_____________________________________________________________

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

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

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions