Question: program in C++ Write four functions to perform the following tasks: a. ReadData: this function opens a file arrays.txt and reads its contents into an

program in C++

Write four functions to perform the following tasks:

a. ReadData: this function opens a file arrays.txt and reads its contents into an integer array named A. You may assume that arrays.txt includes the following 10 integers values (you need to create it first):

40 1 30 4 52 26 7 18 9 10

b. PrintArray: this function prints the elements of an array of any size.

c. ReverseArray: this function reverses an array of any size in place.

d. MinMax: this function returns the minimum and maximum elements in an array of any size. This function should be void.

Write a main program that:

- Declares an array A of size 10

- Calls the function readData to initialize array A

- Calls the function printArray to print the elements of array A

- Calls the function reverseArray and send A as an argument

- Calls the function printArray to print the elements of array A

- Calls the function minMax and send A as an argument. The results should be printed in main.

NOTE: Any parameter that is not supposed to be changed inside a function must be declared as a constant parameter.

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!