Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4. Complete the program minmax.cpp which uses two functions readdata and minmax to find the maximum and minimum of a set of floats stored in

image text in transcribedimage text in transcribed

4. Complete the program minmax.cpp which uses two functions readdata and minmax to find the maximum and minimum of a set of floats stored in the file minmax.txt. You can assume that the number of values in the file is less than 100. ssignment #1 This first number in this file is an int indicating the number of floats which follow. The function readdata opens the input file minmax.txt reads the first number, n, and then reads the following n floats into an array. The file is then closed by the function. The function minmax computes the minimum and maximum values found in the array. The main program prints the maximum and minimum. The content of the output fileminmaxout.txt will be: 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 #include using namespace std; const int N = 100; // maximum array size void readdata(/* you fill in here */); void minmax(/* you fill in here */); int main(void) ofstream outfile("minmaxout.txt"); float x[N]; int n; float max; float min; // the array // the actual array size // the maximum // the minimum /* read the data into the array */ readdata (/* you fill in here */); /* compute the maximum and minimum */ minmax(/* you fill in here */); outfile

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Students also viewed these Databases questions

Question

=+3. What is the significance or importance of the situation?

Answered: 1 week ago

Question

What is a verb?

Answered: 1 week ago

Question

Design a training session to maximize learning. page 296

Answered: 1 week ago

Question

Design a cross-cultural preparation program. page 300

Answered: 1 week ago