Question: C++ Please: numMembers is read from input as the size of the vector. Then, numMembers elements are read from input into the vector bikingRoster. Use

C++ Please:

numMembers is read from input as the size of the vector. Then, numMembers elements are read from input into the vector bikingRoster. Use a loop to access each element in the vector and if the element is less than averageMembers, output the element followed by a space.

Ex: If the input is 8 173 88 61 135 90 59 168 92, then the output is:

Average: 108 Numbers less than average: 88 61 90 59 92

#include #include using namespace std;

int main() { int numDistance; unsigned int i; double averageDistance; int sumElementData = 0;

cin >> numDistance; vector swimmingRoster(numDistance);

for (i = 0; i < swimmingRoster.size(); ++i) { cin >> swimmingRoster.at(i); sumElementData += swimmingRoster.at(i); }

averageDistance = sumElementData / swimmingRoster.size();

cout << "Average: " << averageDistance << endl; cout << "Numbers greater than average: ";

/* Your code goes here */

return 0; }

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!