Question: Write a C++ function to print the parent and child value of a node with a value in it. Function Arguments: head: head of the

Write a C++ function to print the parent and child value of a node with a value in it. Function Arguments: head: head of the linked list with at least three values in it valueToFind: find the node with the value of valueToFind; print this node's parent and child value separated by a semicolon The node where valueToFind is found will always have at least one node before it and one node after it. Do not include endl in your cout statement. void PrintBeforeAndAfter(node *head, int valueToFind); The linked list structure: struct node int value; node *next; node *prev; b: Example: Linked list pointed to by head: 4 7 8 22 valueToFind = 8 You're function should print: 7:22 For example: Test Result //1 2 3 -> 4 | 234 //valueToFind
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
