Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Complete the program minmax.cpp which uses two functions readdata() and minmax () to find the minimum and maximum of q 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 protolypes
int main (void)
i
// open input and output files
// declare variables and allocate array x
/1 call readdata() to read values from the input file to the array
// call minmax() to compute the minimum and manimum values
// print the results to the output fite
// elose files
return ;
// 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 vect or is allocated within the function void readdata(). Call your new program minmaxy, cpp with output file minmaxyout, txt. The output of the program will not change.
image text in transcribed

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

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning ASP.NET 4.5 Databases

Authors: Sandeep Chanda, Damien Foggon

3rd Edition

1430243805, 978-1430243809

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago