Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This program is supposed to accept scores and should store the count of each in an array. The scores must be in the range (0,4).

This program is supposed to accept scores and should store the count of each in an array. The scores must be in the range (0,4). and the program should terminate when 99 is entered. Upon exit it should prints out the distribution of scores with stars. A sample input and output is as follows.

Enter 99 to terminate. Please enter a score in the range (0,4): 0 Please enter a score: 0 Please enter a score: 0 Please enter a score: 1 Please enter a score: 2 Please enter a score: 2 Please enter a score: 3 Please enter a score: 3 Please enter a score: 3 Please enter a score: 3 Please enter a score: 99 Score Distribution 0*** 1* 2** 3**** 4

//M06-01 Debugging The Program for Displaying the Distribution #include using namespace std;

int main(void){ const int NUM_ELEMENTS = 5; int counts[NUM_ELEMENTS] = {0}; int score; cout << "Enter 99 to terminate. "; //get inital score from user cout << "Please enter a score in the range (0,4): "; cin >> score; while(score != 99){ counts[score]++; cout << "Please enter a score: "; cin >> score; } //prints the distribution cout << " Score Distribution "; for(int i=0; i

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

1. Discuss the four components of language.

Answered: 1 week ago

Question

f. What stereotypes were reinforced in the commercials?

Answered: 1 week ago