Question: PLEASE DO NOT COMPLICATE THE PROGRAM. I NEED IT URGENTLY ASAP. USE C++ AND DO NOT WRITE IT FROM ONLINE. Modify the Program such that
PLEASE DO NOT COMPLICATE THE PROGRAM. I NEED IT URGENTLY ASAP. USE C++ AND DO NOT WRITE IT FROM ONLINE.
Modify the Program such that the program gives a menu option to (1) add a node with a value, (2) delete a node with a value, (3) terminate the program. (You need to have the complete header file, NumberList.h, which include the NumberList class with its member functions defined.)
Whenever a node is added or deleted the contents of the linked list should be displayed on the screen.
The program is listed below:
// This program demonstrates the deleteNode member function.
#include
using namespace std;
int main() {
// Define a NumberList object.
NumberList list;
// Build the list with some values.
list.appendNode(2.5); list.appendNode(7.9); list.appendNode(12.6);
// Display the list.
cout << "Here are the initial values: "; list.displayList(); cout << endl;
// Delete the middle node.
cout << "Now deleting the node in the middle: "; list.deleteNode(7.9);
// Display the list.
cout << "Here are the nodes left. "; list.displayList(); cout << endl;
// Delete the last node.
cout << "Now deleting the last node: "; list.deleteNode(12.6);
// Display the list.
cout << "Here are the nodes left. "; list.displayList(); cout << endl;
// Delete the only node left in the list.
cout << "Now deleting the only remaining node. "; list.deleteNode(2.5);
// Display the list.
cout << "Here are the nodes left. "; list.displayList();
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
