Question: C C++ question using nested loop and return the second smallest sum (not the smallest)! 4. Nested Loops 4-1 Write a function, secondSmallestSum that when

CC C++ question using nested loop and return the second smallest sum(not the smallest)! 4. Nested Loops 4-1 Write a function, secondSmallestSum that

C++ question using nested loop and return the second smallest sum (not the smallest)!

4. Nested Loops 4-1 Write a function, secondSmallestSum that when passed an int array of any length greater than 1 will calculate the sum of the elements of every possible sub-array and then return the second smallest sum found. It is possible for the smallest and second smallest sums to have the same value of length 4, [1,2,3,4), then the complete set of sub-arrays is: 1, 1,2), 1,2,3, 1,2,3,4, 2, 12,3, 12,3,4, 3, 3,4), 14 the sum of each sub-array is then: 1, 3, 6, 10, 2, 5, 9, 3, 7, 4 You should start by copying the function-1-1.cpp file and name it function-4-1.cpp. Then add the function secondSmallestSum to the new file. The main function for this problem must call your readNumbers function, then pass the new array to your secondSmallestSum function, display the second smallest sum found and finally delete the array. The main function in the file main-4-1.cpp. The signature for your new function is: int secondSmallestSumCint *numbers,int length)

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!