Answered step by step
Verified Expert Solution
Question
1 Approved Answer
the functions readdata ( ) and minmax ( ) and finally prints the minimum and maximum values to the output file minmaxout . txt .
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 values.
The function readdata reads the first number, from the input file and then reads the following 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 elements
The maximum value in the array is
The minimum value in the array is
File: minmax.cpp
Programmer:
Date:
include libraries
using namespace std;
const int maximum array size
function prototypes
int main void
open input and output filas
declare variables and allocate array
call readdata 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
close 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 #
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.
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