Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello, I'm having a problem with my code on some of the testing... My code compiles and does a compared output, my issue comes to

image text in transcribedHello, I'm having a problem with my code on some of the testing...image text in transcribed

My code compiles and does a compared output, my issue comes to the other four tests that do the following:

1. Unit Test - Test Node Class.

2. Unit test - Test Linked List Insert Function

3. Unit test -Insert Twice

4. Unit test - Find Node Test

Here's my code:

#include #include using namespace std; class Node { public: Node(int dataInteger1 = 0, Node* nextLocation = 0); void InsertNode(Node* nodePtr); Node* GetNextNode(); void Print(); private: int dataValue; Node* nextNodePtr; }; Node::Node(int myInt, Node* nextLocation){ this -> dataValue = myInt; this -> nextNodePtr = nextLocation; return; } void Node::InsertNode(Node* nodeLocation){ Node* nextTemp=0; nextTemp = this-> nextNodePtr; this -> nextNodePtr = nodeLocation; (*nodeLocation).nextNodePtr = nextTemp; /odeLocation -> nextNodePtr = nextTemp is the form (*a).b return; } void Node::Print(){ cout dataValue nextNodePtr; } ///////////////////////////////// int main(){ Node* head=0; Node* node1=0; Node* currentObject=0; int userInput1, userInput2; cin >> userInput1 >> userInput2; head = new Node(userInput2); node1 = new Node(userInput1); head -> InsertNode(node1); currentObject = head; cout Students This content is controlled by your instructor and is not zyBooks content. Direct questions or concerns about this content to your instructor. If you have any technical issues with the zyLab submission system, use the "Trouble with lab?" button at the bottom of the lab. In this lab we will write code for working with a Linked List Node class represents a single element of the linked list. class Node public Node(); Node prev string ke Node next LinkedList class represent one entire linked list. class LinkedList f public Linked List void Insert (string key) Adds new node to head of list void Print Prints list Node Find (string key); Returns pointer to node with key equal to parameter key. void Delete (Node x Node head Code to insert strings into linked list. while true getline (cin, line if (line empty break l.Insert (line)

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

More Books

Students also viewed these Databases questions

Question

2. What recommendations will you make to the city council?

Answered: 1 week ago

Question

3. The group answers the questions.

Answered: 1 week ago