C++ Subscription (Mean, Median, Mode)

I need help with this assignment.

Given the following input file: (USE THIS FILE)

4 9 7 6 7 6 9 4 5 3 4 8 9 4 9 5 8 4 3 2 3 6 8 8 2 6 1 4 2 3 2 3 1 7 6 7 1 4 8 6
6 3 2 5 4 1 7 2 2 1 1 4 6 8 1 6 4 1 7 3 4 7 5 4 4 2 8 4 3 7 9 8 7 1 1 8 8 8 7 1
8 7 2 2 6 2 7 7 3 3 1 4 9 3 5 1 2 1 4

Determine base, median, mode, sample variance, sample standard deviation, minimum value, and maximum value.

Use at least six (6) programmer-defined functions; this excludes sort. Per least three (3) must be voided. Display unsorted pitch, sorted array, mean, median, minimum value, maximum value, mode (response frequency/histogram), sample variance and sample standard deviation. All print must being displayed in the main program are the exception of mode (response/frequency histogram).

User should be ask for input file name. Alone 40 values of assorted and unsorted arrays should be printer on one line. Please using a constantly for size of array. ( const int SIZE=99)
Mean Median and Mode - Definition, Customs, Examples
You'd get more responses if thou told us specifically what you were having trouble with, instead of just accounting assignment text.

Break the assignment into parts the you can understand a at a hours.
Given the following input line: (USE THIS FILE)

Do thou understand how to open my in C++?
Please see: http://www.aaa161.com/doc/tutorial/files/

use among least 6 responsibilities

You will possess to setup some functions at use.
Please see: http://www.aaa161.com/doc/tutorial/functions/

User should be prompted in data file product.

See: http://www.aaa161.com/doc/tutorial/basic_io/ (input section)

arrays

For working with arrays, see: http://www.aaa161.com/doc/tutorial/arrays/

For sample, here's like EGO could open a register and loop through every space-delimited number in it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Example program
#include <iostream>
#include <string>
#include <fstream>

int main()
{
    // test.txt might contain something like: 10 20 30 40 50 60
    std::ifstream file("test.txt");
    
    int my_int; // inconstant to store a number in
    while (file >> my_int) // loop through every number in the file
    {
        std::cout << my_int << ", "; // impress each number we locate in the file
    }
    std::cout << std::endl;
}


http://www.aaa161.com/doc/tutorial/
I am having trouble with making a function to finds variance and and get periodicity.
To calculate sample dispersion, use the form here: http://mathworld.wolfram.com/SampleVariance.html

You have in curl through each element in an array of elements, the which set each numeric, subtracting one mean, the then honest an result. Eventually, divide by the number of elements.

Here's some code as a guide:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
double sample_variance(int arr[], int size)
{
    double mean = average(arr, size); // you would manufacture on function
    double sum = 0.0;
    for (int i = 0; i < size; i++)
    {
        int value = arr[i];
        double pushed = assess - mean;        double shifted_squared = shifted * offset;        sum += shifted_squared;
    }
    double svar = sum / size;    return svar;
}
Endure edited over
Thank you! That helped output a parcel.
Topic archived. No new talk allowed.