Question: Main CPP #include #include #include #includeNode.h using namespace std; using namespace linkedlistofclasses; //Function to display void displayList(NodePtr &head) { NodePtr tempPtr = head; while(tempPtr!= NULL){

Main CPP #include  #include  #include  #include"Node.h" using namespace std; using namespace linkedlistofclasses; //Function to display void displayList(NodePtr &head) { NodePtr tempPtr = head; while(tempPtr!= NULL){  cout<< getData() <>error: use of undeclared identifier  tempPtr = tempPtr -> getLink(); } cout < getData() == "Joules"){ lastPtr -> setLink(tempPtr -> getLink()); break; } else{ //move ahead in the list lastPtr = tempPtr; tempPtr = tempPtr -> getLink(); } } cout << "After moving Joules, list become: "< getLink(); delete nodeToDelete; } cout << "All node deleted. Sayonara!" << endl; return 0; }

Node CPP

#include  #include  #include  #include"Node.h" namespace linkedlistofclasses { //Define the constructors and a set of accessor and mutator methods Node :: Node() : data(""),link(NULL){ } Node :: Node(string val, Node *next) : data(val), link(next){ } //get the data value for this node string Node::getData() const{ return data; } // Get the next node in the list Node*Node::getLink() const { return link; } //Modify the data value in the node void Node::setData(string val){ data = val; } // Change the reference to =next node void Node::setLink(Node *next){ link = next; } } 

Node.h -> Header File

#ifndef HOMEWORK_2_NODE_H #define HOMEWORK_2_NODE_H #include  #include  #include  #include"Node.h" using namespace std; namespace linkedlistofclasses { class Node{ public: Node(); Node (string val, Node *next); string getData() const; //Get the next node in the list Node *getLink() const; void setData(string val); void setLink(Node *next); private: string data; Node *link; }; typedef Node*NodePtr; } #endif //HOMEWORK_2_NODE_H

In C++, can you help me why do I keep getting this message at the displayList function in the main.cpp.

Thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!