item next;a) Modify it to create a new function displayNodeNum() that will display the numberof nodes in the list, e.g., if there are three nodes, it should display "3 nodes in thelist". If the...


Data structures<br>HW3<br>Q1. Consider the code for displayList() function shown below:<br>void displayList(void)<br>{<br>Node* currNode = head;<br>while (currNode != NULL)<br>{<br>cout<<currNode->item<<endl;<br>currNode = currNode->next;<br>a) Modify it to create a new function displayNodeNum() that will display the number<br>of nodes in the list, e.g., if there are three nodes, it should display

Extracted text: Data structures HW3 Q1. Consider the code for displayList() function shown below: void displayList(void) { Node* currNode = head; while (currNode != NULL) { coutitemnext; a) Modify it to create a new function displayNodeNum() that will display the number of nodes in the list, e.g., if there are three nodes, it should display "3 nodes in the list". If the list is empty then it should display “the list is empty right now". [Hint: you need only add 2 or 3 lines to it.] b) Modify the displayList() or displayNodeNum() function created above to create a new function sumNodeValues() that will display the total of the values of the nodes, e.g. if there are 4 nodes having values 1, 3, 8, 10 then it should display “The sum is 22". [Hint: you need only add 3 or 4 lines to the first function.] c) Create a function findValue(int) that will take a value and display it if it is in the list, e.g. the user enters 3. The function will search 3 in the list. If it is there, it will print "Number 3 is in the list". If it is not there, it will print “Number 3 not found in the list".
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here