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
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