logo CodeStepByStep logo

histogram

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

Write a function named histogram that accepts as a parameter a reference to a vector of integer scores in range 0-49 and prints a histogram of scores bucketed by tens. For example, if the vector scores contains {48, 20, 31, 49, 35, 45, 33, 26, 48, 32, 19}, the call of histogram(scores); should print the following console output:

0's : {}
10's : {19}
20's : {20, 26}
30's : {31, 35, 33, 32}
40's : {48, 49, 45, 48}
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.