Question: Write the following a functions: One that accepts an ifstream and a pointer to an int array as arguments. The function should ask the user

Write the following a functions:

  • One that accepts an ifstream and a pointer to an int array as arguments. The function should ask the user for the number of elements in said list, create a dynamic array, and store the values from the file into it. The function should return the length of the new array.
  • One that accepts a pointer to an int array, and the array's size as arguments. The function should create a copy of the array, except that the elements should be be in reverse order in the copy. The function then returns a pointer to the new array.

Demonstrate both functions in a single program that reads numbers from a file and prints the reversed list on screen. Do not use vectors. Remember that ifstream must be passed by reference.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!