The desired system calculates and prints out


You are given the following main() function and prototypes.
? The desired system calculates and prints out mean and variance based on data in input.txt.
? Your assignment is to complete the system, which is primarily writing the implementations for the function prototypes, including system compilation and test.
// project.cpp
// author: many
#include
#include
#include
#include
using namespace std;
void sum_x_xSquare(ifstream & xin, int & sumX, int & sumXsquare, int & countX);
// calculates sum and sum of squares of numbers read from file
int openIn(ifstream & inputter);
// opens file specified by user input
void mean_variance(float & meanN, float & varianceN, int & countN, ifstream & in);
// computes mean and variance
// uses sum and sum of squares,
void printit(float arithMean, float variance, int count);
// output results
void closeIn(ifstream & inner);
int main()
{
ifstream input;
float mean, variance;
int err, count(0);
err = openIn(input);
if(!err)
{
mean_variance(mean, variance, count, input);
printit(mean, variance, count);
closeIn(input);
}
else
cout << "Failed to open input file!" << endl;


openIn(), openOut(), printit()
- In openIn(), ask user for filename
? hint: recall c_str()
? formula for variance and mean
variance = (Sum of squares)/n - (square of means)
mean = sum/n
n = number of items
output from printit() with input.txt:
count = 10
mean = 30.0
variance = 143.6
output from main() with inputtxt:
Failed to open input file!

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: The desired system calculates and prints out
Reference No:- TGS0128970

Expected delivery within 24 Hours