Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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