Question: Hello, How should I go about this assignment? Thanks for any help! Assignment: Finish the 3 stub functions in the linked file. Do not use

Hello,

How should I go about this assignment?

Thanks for any help!

Assignment:

Finish the 3 "stub" functions in the linked file.

Do not use any built-in mean, median or std. deviation functions in C++.

#include

#include

#include

#include

using namespace std;

double mymedian(vector & in)

{

}

double mymean(vector & in)

{

}

double mystdev(vector & in)

{

}

double mymin(vector & in)

{

double out = in[0];

for (int i=1; i

{

if (in[i] < out)

{

out = in[i];

}

}

return out;

}

double mymax(vector & in)

{

double out = in[0];

for (int i=1; i

{

if (in[i] > out)

{

out = in[i];

}

}

return out;

}

void display(vector & in)

{

for (int i=0; i

{

cout << in[i] << " ";

}

cout << endl;

}

int main()

{

ifstream fin("feb12.txt");

vector list;

double tmp;

fin >> tmp;

while ( not fin.fail() )

{

list.push_back(tmp);

fin >> tmp;

}

display(list);

cout << "min: " << mymin(list) << endl;

cout << "max: " << mymax(list) << endl;

cout << "mean: " << mymean(list) << endl;

cout << "stdev: " << mystdev(list) << endl;

sort(list.begin(), list.end());

cout << "sorted: ";

display(list);

cout << "median: " << mymedian(list) << endl;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!