5. (20 points) Given a dynamically allocated array of doubles (List) and a doubl
ID: 3704809 • Letter: 5
Question
5. (20 points) Given a dynamically allocated array of doubles (List) and a double N, write the function that creates a dynamic array (double *Low) and puts all of the numbers less than or equal to N in the Low array. The array should have no extra space. The function should return the pointer. Assume List has already been populated, but you do not know the numbers in the array. N has also been set, and you also have an integer size that has the number of items in the List. e.g. if List (3.2, 77.9, 43.7,2.0, 60.1], size is 5, and N is set at 50.0, then your code should dynamically create the array Low which has 3.2, 2.0, and 43.7 in the array based off the size and N. This is just an example. Write the code for the general problem. double* GetLow (double* List, int size, double N)Explanation / Answer
double *GetLow(double *List, int size, double N) { int count = 0; for(int i = 0; iRelated 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.