Question
you must use an array (declared in main.cpp ), to store all the integers from the file, prior to processing you must modify your existing
you must use an array (declared in main.cpp), to store all the integers from the file, prior to processing
you must modify your existing readfile and writefile functions, to conform to the following specifications:
void readfile(int arr[], int& count);
//Read unknown count of integers from input and store in array arr[]
// Pre-Condition: Filename is stored in global constant. array and count have been declared in main.
//Post-Condition: infile (global constant in subs.h) has been opened (cerr message and exit program, if fails) for reading; an unknown number of integers has been read from the file and stored in the array; count has been set to equal the number of integers read. Input file has been closed.
//Libraries used:
void writefile(double avg, int count);
// Write average and count values to output file, with labels (see sample output)
// OUTPUT FORMAT: labels should be in column 1, width 20, right aligned; values should be in column 2, witdth 10, right aligned, fixed decimal, with 2 digits of precision (see examples)
//Pre-Condition: average and count have already been determined; output file does not exist or will be overwritten.
//Post-Condition: average and count values has been written to output file and file closed. If unable to open output file for writing, send error message to cerr, and exit program.
//Libraries used: ....
create a function to compute the averages (remove/replaces functionality for min/max)
double average(const int arr[], int count);
// Computes the average for numbers in array, representing one input file
//Pre-Condition: arr and count have been stored
//Post-Condition: average is returned
?
define Sues H tincludeStep 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