Question: Complete the program minmax.cpp which uses two functions readdata ( ) and minmax ( ) to find the minimum and maximum of a set of

Complete the program minmax.cpp which uses two functions readdata() and minmax() to find the minimum and maximum of a set of floats stored in the file minmaxin.txt.
The main program opens the input and output files, and allocates a float array x, then calls the functions readdata() and minmax () and finally prints the minimum and maximum values to the output file minmaxout. txt.
The input file minmaxin.txt includes a single column of data, where the first number (an int) indicates the number of floats which follow. You can assume that the file holds no more than 100 values.
The function readdata() reads the first number, n, from the input file and then reads the following n floats into the array.
The function minmax () computes the minimum and maximum values found in the array.
Here is the expected program output:
The array has 80 elements
The maximum value in the array is 63.606
The minimum value in the array is 4.8089
File: minmax. cpp
Programmer:
Date:
**
// include libraries
using namespace std;
const int MxN=100;?? maximum array size
// function prototypes
Int main (void)
i
// open input and output files
// declare variables and allocate array x
// call readdate() to read values from the input file to the array
// call minmax() to compute the minimum and maximum values
// print the results to the output file
/1 elose files
}
return 0 ;
// function definitions
Modify the previous program so that the array is dynamically allocated within the function void readdata(). Call your new program minmaxd. cpp with output file minmaxdout.txt. The output of the program will not change.
Assignment # 2
3
Modify the previous program so that a vector is allocated within the function void readdata (). Call your new program minmaxv. cpp with output file minmaxvout. txt. The output of the program will not change.
 Complete the program minmax.cpp which uses two functions readdata() and minmax()

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!