Question: C++ Program, assume there are a helper file and the main function implemented already Problem 1 (Mandatory) Task: Write a program that creates a linked

C++ Program, assume there are a helper file and the main function implemented already

C++ Program, assume there are a helper file and the main function

Problem 1 (Mandatory) Task: Write a program that creates a linked list of integers and a function that sums all the even values in the list. Requirements: 1. Implement a sumEvens function: (you may change the function header below to suit your implementation) int sumEvens (Node *head); // example declaration This function should return the sum of all even integers in the list. If the list is empty, return o. Examples: * If the list is 7 -> 4 -> 6 -> 2 -> NULL, calling sumEvens (head) should return 12. * If the list is 3 -> 9 -> 2 -> NULL, calling sumEvens (head) should return 2. * If the list is NULL, calling sumEvens (head) should return o. 2. Write a main function that creates a linked list of integers, then calls the function defined in part (1) to demonstrate the method. Call it on multiple lists to show that it works in all cases, and print out the results. 3. Test your function to make sure that it works in every case, no matter how many nodes are in the linked list

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!