Question: Program 1 Write four functions to perform the following tasks: a. ReadData: this function opens a file arrays.txt and reads its contents into an integer

Program 1 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 452 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. Extra Practice: LongestSequence: this function finds and returns the length of the longest consecutive sequence of numbers in an array of any size. You may assume that the array is sorted in ascending order. For example. Longest sequence of 1,2,3,4,4,4,5,7,9,10; is 5. Note that repeated numbers in a sequence are skipped Longest sequence of {0,1,3,4,5,6,7,8,9,10; is 8. Longest sequence of 10,2,3,4,5,7,10,11,12,15} is 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
