Question: please solve this (in c++) LAB EXERCISE: 1. Create a new project with the name Lab3_ LinkListProject. 2. Create a C++ file with name LinkedList


CCS224 LAB 3: Linked List 1 LAB EXERCISE: 1. Create a new project with the name Lab3_LinkList Project. 2. Create a C++ file with name LinkedList and copy struct node class into it. 3. Add main method and complete the balnk with suitable statements int main() { // construct four linked list nodes and add their values( see output) // display the nodes values using printAllNodes() // print the largest value in the linked list // print the value of the second node // print the value of the second last node // delete the last node // display the nodes values using printAllNodes() // modify the nodes values by using odd2Even2Odd method // display the nodes values using printAllNodes() return 0; } CCCS224 LAB 3: Linked List 1 4. Add the following methods to the file: Taskl: a method named find Largest() which finds the largest value in the linked list and returns its data to the calling main() method. Hint: Use following method header: int findLargest (node* head) { } Task2: a method named data2ndNode() which returns the data of second node in the linked list, to the calling main() method. Hint: Use following method header: node* data2ndNode (node* head) { . Task3: a method named data2ndLastNode() which returns the data of second last node in the linked list, to the calling main() method. Hint: Use following method header node* data2ndLastNode (node head ) Task4: a method named delete LastNode() which deletes last node in the existing linked list. Hint: Use following method header. void deleteLastNode (node* head) { CCCS224 LAB 3: Linked List 1 Task5: a method named odd2Even2Odd() which changes all odd value nodes into even by subtracting 1 from every odd node and all even value nodes into odd by adding 1 into every even node. Hint: Use following method header: void odd2Even20dd (node* head) { } Output: the nodes have been constructed with values: 10 21 6 8 the largest value is: 21 second node ha the value: 21 second last node has the value: 6 last node with value 8 has been deleted!! The list after deleting a node: 10 21 6 The list after modifing the nodes values 11 20 7 ... Program finished with exit code o Press ENTER to exit console
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
