Question: Write a C++ program that asks the user to enter the number of students in a particular class, and the number of tests that the



Write a C++ program that asks the user to enter the number of students in a particular class, and the number of tests that the students have taken. Your program should then dynamically allocate two arrays: one string array (student_names) whose size will be equal to the number of students, and one double array (average) whose size will also be equal to the number of students. Your program should then ask the user to enter the names of each student in the class. When the user enters a student's name, store the name in the student_names array. After the user enters all student names into the student_names array, sort this array in ascending order by using the selection sort algorithm. Then, for each student, your program should ask the user to enter the score made on each test. After the user has entered all test scores for an individual student, calculate the average test score for that student and store this value in the average array. Finally, print a report that displays each student's name and that student's average test score. Input Your program should ask the user to enter the number of students, the number of tests, and the full name of each student. For this assignment you do not have to test for valid user input. Functions Your program should contain a total of nine functions including the main function. All functions except the main function are described in the following table: void Function Name Description Returns Reads the number of students and the number of tests from getInfo the keyboard and stores them in int variables. The variables used to hold these values should be passed by reference. allocateStringArray Allocates memory for the dynamic string array student_names. pointer allocate DoubleArray Allocates memory for the dynamic double array average. pointer Reads each student's full name from the keyboard and stores getNames each name in the student_names array. Pass the array to the void getNames function as a pointer. Sorts the names in the student_names array in ascending selection Sort order. Pass the student_names array to the selectionsort void function as a pointer. Reads test scores for each student and then calculates the getTestScoresAndAverages average test score and stores the average in the average array. void Pass the student_names array and the average array to this function as pointers. Displays each student's name and the average test score for displayOutput each student. Pass the student_names array and the average void array to this function as pointers. releaseArrays Releases dynamic memory and sets pointers to null. Pointers void must be passed by reference. The main Function The screenshot below shows how the main function should appear. Do not define any global variables in your program. 4 5 6 7 8 9 1e 11 12 13 14 Test Scores.cpp 2 #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
