On this lab you will implement a program that will ask for a number of students, then ask for their scores, and use the
Posted: Wed Apr 27, 2022 5:02 pm
On this lab you will implement a program that will ask for a
number of students, then ask for their scores, and use the scores
to print the lowest, largest and average score, as well as a
histogram of the scores (with buckets every 20 points). Study the
tests below to help you understand program behavior. Use the
following tests and your own tests to run against your solution in
Develop mode. These are the same tests that your solution will be
executed against when you submit your work in Submit mode.
User input is in bold: Sample Runs (Program Behavior) User in
put is in bold:
Test 1 > run
Enter the number of students: -1↲
Please enter a positive number: 2↲
Enter the scores: 10 90↲
Min score: 10
Max score: 90
Average: 50
Range | Count 0 - 19 | * 20 - 39 | 40 - 59 | 60 - 79 | 80 - 100
| *
#include #include #include const int BUCKETS = 5; using
namespace std; int get_student_count (const string & msg,
ostream & out, istream & in); vector read_scores(const
string & msg, ostream & out, istream & in, int count);
void output_min_max_avg(const vector & scores, ostream &
out); void create_histogram(const vector & scores, ostream
& out); void print_histogram (const int buckets[BUCKETS],
ostream & out); void print_stars(ostream & out, const int
count); int main() { int count = get_student_count ("Enter the
number of students: ", cout, cin); vector scores =
read_scores("Enter the scores: ", cout, cin, count);
output_min_max_avg(scores, cout); create_histogram(scores, cout);
return 0; } int get_student_count (const string & msg, ostream
& out, istream & in){ } vector read_scores(const string
& msg, ostream & out, istream & in, int count){ } void
output_min_max_avg(const vector & scores, ostream & out){ }
void create_histogram(const vector & scores, ostream &
out){ } void print_histogram (const int buckets[BUCKETS], ostream
& out){ } void print_stars(ostream & out, const int count){
}
number of students, then ask for their scores, and use the scores
to print the lowest, largest and average score, as well as a
histogram of the scores (with buckets every 20 points). Study the
tests below to help you understand program behavior. Use the
following tests and your own tests to run against your solution in
Develop mode. These are the same tests that your solution will be
executed against when you submit your work in Submit mode.
User input is in bold: Sample Runs (Program Behavior) User in
put is in bold:
Test 1 > run
Enter the number of students: -1↲
Please enter a positive number: 2↲
Enter the scores: 10 90↲
Min score: 10
Max score: 90
Average: 50
Range | Count 0 - 19 | * 20 - 39 | 40 - 59 | 60 - 79 | 80 - 100
| *
#include #include #include const int BUCKETS = 5; using
namespace std; int get_student_count (const string & msg,
ostream & out, istream & in); vector read_scores(const
string & msg, ostream & out, istream & in, int count);
void output_min_max_avg(const vector & scores, ostream &
out); void create_histogram(const vector & scores, ostream
& out); void print_histogram (const int buckets[BUCKETS],
ostream & out); void print_stars(ostream & out, const int
count); int main() { int count = get_student_count ("Enter the
number of students: ", cout, cin); vector scores =
read_scores("Enter the scores: ", cout, cin, count);
output_min_max_avg(scores, cout); create_histogram(scores, cout);
return 0; } int get_student_count (const string & msg, ostream
& out, istream & in){ } vector read_scores(const string
& msg, ostream & out, istream & in, int count){ } void
output_min_max_avg(const vector & scores, ostream & out){ }
void create_histogram(const vector & scores, ostream &
out){ } void print_histogram (const int buckets[BUCKETS], ostream
& out){ } void print_stars(ostream & out, const int count){
}