How many elements in the array have the same sum as largest


Problem

Define a function named "getLargestSum" that accepts an array of SumOfTwo objects and its size. It will return the following information to the caller:

• The index of the array element where it has the largest sum (if there are multiple sums with the same value, it needs to return the index of the first one)

• How many elements in the array have the same sum as the largest. Show how this function is being called and return proper information.

• Here are test data:

{ {10, 5} } ;
{ {10, 5}, {20, 2}, {30, 1} } ;
{ {10, 5}, {13, 2}, {4, 11} } ;
{ {30, 5}, {40, 2}, {10, 1} } ;
{ {10, 5}, {5, 10} } ;
{ {10, 5}, {20, 2}, {10, 1}, {10, 12}, {2, 20}, {4, 3} } ;

And its expected returned values:

Index: 0 Largest count: 1
Index: 2 Largest count: 1
Index: 0 Largest count: 3
Index: 1 Largest count: 1
Index: 0 Largest count: 2
Index: 1 Largest count: 3

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: How many elements in the array have the same sum as largest
Reference No:- TGS03311574

Expected delivery within 24 Hours