Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program to read 1) the number of students in a class and 2) the grade for each student. Save the grades in a
Write a program to read 1) the number of students in a class and 2) the grade for each student. Save the grades in a dynamic array of floating-point numbers. Allocate memory for the array after finding the number of students in the class. Then, read the grade for each student and save it in the array. Once all grades are read, print the grades from the highest to the lowest. Finally print the average class grade. Make your program modular by creating the following functions and calling them appropriately done with it. void readGrades (double *, int); from within the main function. Don't forget to free memory for the dynamic array after you are This function receives a pointer to an array of double-precision numbers and the dimension of the array. It then interactively reads n grades from input, one at a time, and saves them in the array. double findAverage (double *, int); This function receives a pointer to an array of double-precision numbers and the dimension of the array. It then finds the average of numbers in the array and returns it. Void printHighestToLowest (double *, int); This function receives a pointer to an array of double-precision numbers and the dimension of the array. It then prints the numbers from the highest to the lowest without sorting the array. Hint:1) Negate all numbers in the array. 2) Find the lowest number in the array, negate it, and then print it. Repeating step 2 one more time will print the second highest number. Repeating step 2 a sufficient number of times will print all numbers in the array from the highest to the lowest
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started