Question: 2 . ( 2 5 ) Write a program that outputs a histogram of grades for an assignment given to a class of students. The

2.(25) Write a program that outputs a histogram of grades for an assignment given to a class of students. The program should input each student's grade as an integer and store the grade in a vector. Grades should be entered until the user enters"-1" for a grade. Use a map from an int to an int to compute the histogram. The first integer in the map represents the grade and the second integer represents the number of times that grade occurred. Output the histogram to the console. Break the histogram bins into values of 10, that is, grades between 0-10 are in bin 1(call it "10"), grades between 11-20 are in bin 2(call it "20"), grades between 21-30 are in bin 3(call it "30"), etc until the highest bin for your grades. There should be no restrictions on the minimum and maximum grade for this programming project, that is, the bins are not stopping at "100", add as many as needed based on user input. A sample output (for input values up to 99 by the user) is shown below: The histogram for the grades entered is: 10: 020: 030: 240: 150: 460: 970: 1680: 2590: 8100: 5 Use the following sequence of grades as a test input (enter them one per line or separated by a space for easier entry): 79,5,11 XO032,60,75,98,105,34,90,90,49,25,12,98,119,76,80,81,67,99,56,98,-1.

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 Programming Questions!