Final answer:
To handle the problem described, calculate the average of the elements in the input vector and then display elements that are greater than the computed average. This involves loops for summing elements, computing the average, and then comparing each element to the average.
Step-by-step explanation:
The question involves reading a size of the vector and its elements from the input, computing their average, and outputting the values greater than the computed average. To solve this, you would initiate a loop to sum all the elements, calculate the average, and then use another loop to compare each element with the average. Elements that are larger than the average should be outputted.
Here is a step-by-step way to achieve this:
- Read the numMembers, which represents the number of elements in the walkingLogs vector.
- Read the walkingLogs vector elements from the input.
- Compute the sum of all elements in the walkingLogs vector.
- Calculate the average by dividing the sum by the number of elements (numMembers).
- Print the average.
- Go through the vector again and compare each element with the average.
- Print elements that are greater than the average followed by a space.
For the given example 4 182 82 39 81, the average is 96, and the number greater than the average is 182.