Question: C++ Problem: I am trying to delete a node from a doubly linked list in a C++ program. The function is passed a head pointer

C++ Problem:

I am trying to delete a node from a doubly linked list in a C++ program. The function is passed a head pointer and a city name. It is supposed to search the linked list and delete the node with the city name that matches the passed cityName string. It is then supposed to reconnect the list after deleting the desired node. This is where I think I am making a mistake. Also, if the node doesn't exist or the list is empty, it prints out a statement "City does not exist." Please help me slove this problem! Below is my code thus far and I have inculded my Code Runner failed test case. Also included is my city structure. You may NOT change the structure!

C++ Problem: I am trying to delete a node from a doubly

linked list in a C++ program. The function is passed a head

Test Cases:

pointer and a city name. It is supposed to search the linkedlist and delete the node with the city name that matches thepassed cityName string. It is then supposed to reconnect the list after

//DO NOT MODIFY THIS STRUCT struct city string name; // name of the city city *next; /I pointer to the next city int numberMessages; // how many messages passed th string message; // message we are sending accross rough this city

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!