logo CodeStepByStep logo

countInRange

Language/Type: C++ vector collections STL
Related Links:

Write a function named countInRange that accepts three parameters: a reference to a vector of integers, a minimum and maximum integer, and returns the number of elements in the vector within that range inclusive. For example, if the vector v contains {28, 1, 17, 4, 41, 9, 59, 8, 31, 30, 25}, the call of countInRange(v, 10, 30) should return 4. If the vector is empty, return 0. Do not modify the vector that is passed in.

Function: Write a C++ function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.