Write a program that dynamically allocates an array large enough to hold a user-
ID: 3639503 • Letter: W
Question
Write a program that dynamically allocates an array large enough to hold a user- defined number of test scores. Once all the scores are entered, the array should be passed to a func-tion that sorts them in ascending order. Another function should be called that calculates the average score. The program should display the sorted list of scores and averages with appropriate headings. Use pointer notation rather than array notation whenever possible and make sure you delete the array after displaying the scores.Input Validation: Do not accept negative numbers for test scores.
Explanation / Answer
#include #include #include #include using namespace std; int getInt(const string&); void sortIntArray(int *, int); float computeAvg(const int * const, int); int main(int argc, char *argv[]) { int N, *scores; while ((N = getInt("Enter number of scores: "))Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.