Question

In: Computer Science

Create a C++ program that calculates an unbiased standard deviation of 5 input numbers. Please Submit:...

Create a C++ program that calculates an unbiased standard deviation of 5 input numbers.

Please Submit:

1. A flowchart of your program. (3 points)

2. Your C++ program with a heading comment, also appropriate spacing and indentation in the program body.

3. Copy of a screenshot after your program is executed. (Section 2 and3: 7 points)

/* ELEN 1301 Programming Assignment #8.

Name : Your name.

Student ID : Your student ID #.

Due date :

Purpose of the program : Creating a program that usus an array and calculate an unbiased standard deviation.

Section 1 : Receive a number and store it in an array. We assume there will be always 5 input numbers.

Section 2 : Repeat Section 1 five times.

Section 3 : Find the mean of the five numbers.

Section 4 : Subtract mean from each input that is stored in the array. Square it.

Section 5 : Repeat Section 4 for all the stored input, so that the summention is done.

Section 6 : Divide the sum by (N – 1), in this case it would be 4, and take a square root of the value to show the Standard Deviation.

Solutions

Expert Solution

Here is your C++ program to find out unbiased standard deviation of 5 input numbers.

Please hit that like or thumbs-up button, it really motivates me>3

stdDeviation..cpp

#include <iostream>
#include <cmath>
using namespace std;

float CalstdDeviation(float StoreArr[]);

int main()
{
    int i;
    float StoreArr[5]; // Array to store
    // User input ,limited to 5 only
    cout << "Enter five(5) elements: ";
    for(i = 0; i < 5; ++i)
        cin >> StoreArr[i];

    cout << endl <<"Standard Deviation = " << CalstdDeviation(StoreArr)<<endl;

    return 0;
}
// Function to find out standard deviation
float CalstdDeviation(float StoreArr[])
{
    // variables
    float sum = 0.0, mean, standardDeviation = 0.0;

    int i;

    for(i = 0; i < 5; ++i)
    {
        sum += StoreArr[i];
    }

    mean = sum/5;

    for(i = 0; i < 5; ++i)
        standardDeviation += pow(StoreArr[i] - mean, 2);

    return sqrt(standardDeviation / 5);
}

Output: - Refer to screenshot

Flowchart :- Refer to below image

Again Please hit that like button>3 (I hope you will do that?)

Thank you!!


Related Solutions

Program this using C please The program will read from standard input two things - a...
Program this using C please The program will read from standard input two things - a string str1 on the first line of stdin (this string may be an empty string) - a string str2 on the second line of stdin (this string may be an empty string) Note that stdin does not end with '\n'. The program will output a string that is the concatenation of string str1 and string str2 such that any lower-case alphabet character (a-z) will...
In C Program #include Create a C program that calculates the gross and net pay given...
In C Program #include Create a C program that calculates the gross and net pay given a user-specified number of hours worked, at minimum wage. The program should compile without any errors or warnings (e.g., syntax errors) The program should not contain logical errors such as subtracting values when you meant to add (e.g., logical errors) The program should not crash when running (e.g., runtime errors) When you run the program, the output should look like this: Hours per Week:...
IN C++ PLEASE Requirements Write a program that takes in user input of two integer numbers...
IN C++ PLEASE Requirements Write a program that takes in user input of two integer numbers for height and width and uses a nested for loop to make a rectangle out of asterixes. The creation of the rectangle (i.e. the nested for loop) should occur in a void function that takes in 2 parameters, one for height and one for width. Make sure your couts match the sample output (copy and paste from those couts so you don't make a...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic:...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic: Ask for a number, add that number to the front of the list, print the list. Repeat until they enter -1 for the number. . Sample Input: 10, 15, 5, 2, 4, -1 Output: 4, 2, 5, 15, 10. Next sort all the numbers using selection sort and display them. Next give the user option to search for a specific number in the list....
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic:...
IN C++. Objective: Create a Singly linked list of numbers based upon user input. Program logic: Ask for a number, add that number to the front of the list, print the list. Repeat until they enter -1 for the number. . Sample Input: 10, 15, 5, 2, 4, -1 Output: 4, 2, 5, 15, 10. Next sort all the numbers using selection sort and display them. Next give the user option to search for a specific number in the list....
Create a program that asks the user to input three numbers and computes their sum. This...
Create a program that asks the user to input three numbers and computes their sum. This sounds simple, but there's a constraint. You should only use two variables and use combined statements. You can use the output below as a guide. Please enter the first number: 4 Please enter the second number: 2 Please enter the third number: 9 The sum of the three numbers is: 15.
Submit a java file. Write a program where you input 4 numbers and the output generates...
Submit a java file. Write a program where you input 4 numbers and the output generates the average of the 4 numbers. The output may not be negative and <= 100. If any value is negative or >100, it should be replaced by the value of 30. For all such values, you will replace them with a value of 10. The program should produce the following output: Today's average amount is: $xx.xx.
Write a program that calculates mean and standard deviation for four user entered values. The most...
Write a program that calculates mean and standard deviation for four user entered values. The most common measures of a sample are the mean and the standard deviation. the mean is the sum of the values divided by the number of elements in the data set. The dispersion - or spread in the values - is measured by the standard deviation The equation for the mean is x¯ = x1 + x2 + · · · + xn The equation...
in C please! Write a code that asks user for input N and calculates the sum...
in C please! Write a code that asks user for input N and calculates the sum of the first N odd integers. There should be a "pure" method that calculates the sum separately that Main method should call when printing the output.
C Program: Create a C program that prints a menu and takes user choices as input....
C Program: Create a C program that prints a menu and takes user choices as input. The user will make choices regarding different "geometric shapes" that will be printed to the screen. The specifications must be followed exactly, or else the input given in the script file may not match with the expected output. Important! Consider which control structures will work best for which aspect of the assignment. For example, which would be the best to use for a menu?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT