Question: Could i please get some help with this, it would mean a lot, thank you !! 4. Complete the following tasks: Task 1: Create a

Could i please get some help with this, it would mean a lot, thank you !!

Could i please get some help with this, it would
4. Complete the following tasks: Task 1: Create a function that takes a list of integers and a function pointer, and applies the function on each element of the list. The function pointer should point to a function that takes an integer and returns void. Task 2: Create a lambda function that takes two integers and returns their sum. Task 3: Create a lambda function that takes a list of integers and returns the sum of all the elements in the list. Task 4: Create a lambda function that takes a list of integers and returns the product of all the elements in the list. Task 5: Create a lambda function that takes a list of integers and a predicate function pointer, and returns a new list that contains only the elements that satisfy the predicate. The predicate function pointer should point to a function that takes an integer and returns a boolean. Task 6: Create a lambda function that takes a list of integers and a function pointer, and returns a new list that contains the elements sorted in descending order. The function pointer should point to a function that takes two integers and returns true if the first integer is greater than the second, and false otherwise. Task 7: Create a lambda function that takes a list of integers and a function pointer, and returns the first element in the list that satisfies the predicate. The function pointer should point to a function that takes an integer and returns a boolean. Instructions: 1. Start by declaring a list of integers and initializing it with some values. 2. Implement each Task one at a time. a. Test your functions by calling them with the list of integers you created in step 1 before proceeding with the next 3. Write a main function that calls all the lambda functions. As additional practice, modify your code using Templates so that it works with any data type, not just integers

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 Programming Questions!