Question: Will upvote if correct In this problem, you will declare and define the function LargestVectorSum in the header file solution.hpp and source file solution.cc respectively,

Will upvote if correct In this problem, you will declare and define the function LargestVectorSum in the header file solution.hpp and source file solution.cc respectively, using the C++ conventions introduced in the daily lessons. Your LargestVectorSum function must be defined with single parameter, a two-dimensional std::vector of ints. LargestVectorSum will return an object typed LargestSumpair. We provide the definition of this structured type in largest-sum-pair.hpp; do not change that definition. Now that the return type and signature of LargestVectorsum has been specified, let's discuss what this function is to do and how the returned object is to be composed. LargestVectorSum will examine the two-dimensional vector of integers passed to it row-by-row. Your function will track the index of the row whose contents sum to the largest (most positive) integer value and record what that sum was. Keep in mind, that a vector's row may have positive and negative values. Do not assume that the rows contain an equal number of columns: the number of columns in one row can (and will) differ from one another. If more than one row sums to the same value, and that value is the largest sum, record the row with the smaller index. What does smaller index mean? Given a two-dimensional vector indexed as vect.at(row). at(col), we mean the row with a smaller value of row. Once you're finished examining the two- dimensional vector, create a new LargestSumPair object, initializing the data member index with the index of the row whose contents sum to the largest (most positive) integer value and sum with the sum calculated for that row. Assume the vector passed to your function will have at least one row.

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!