Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Oracle Database 19c DBA By Examples Installation And Administration

Authors: Ravinder Gupta

1st Edition

B09FC7TQJ6, 979-8469226970

More Books

Students also viewed these Databases questions

Question

The Nature of Nonverbal Communication

Answered: 1 week ago

Question

Functions of Nonverbal Communication

Answered: 1 week ago

Question

Nonverbal Communication Codes

Answered: 1 week ago