Question: C++ Based on Problem P7.7 Exercise P7.7. Write a function that reverses the values of an array of floating-point data: void reverse(double a[], int a_size)
C++ Based on Problem P7.7
Exercise P7.7. Write a function that reverses the values of an array of floating-point data:
void reverse(double a[], int a_size)
In the function, use two pointer variables, and not integer indexes, to traverse the array elements.
Write the function reverse(double* a, int a size()) described in Problem P7.7. Write a program that reads in a list of numbers contiguously and saves them in a dynamically allocated array. Do NOT use vectors in this problem (see the explanation of how to handle it in the problem 2). Let double* a be the pointer associated with the array and int a size be the variable containing its size. Apply the function reverse to the array located at a to reverse the order of its elements. Then display the numbers using the delimiter , . When displaying the numbers of the reversed array use a pointer variable, and not an integer index, to traverse the array elements. Implement a loop in which the above actions are repeated until the user requests to quit. Assume that the users input is always valid. Assume that the character after the last number in the input list is the newline character and that there is exactly one space between the numbers in the list.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
