Given a set of values representing a complete population, the standard deviation is found by taking the square root of the average of the squared deviations of the values from their average value. For an example of what that means, see the following Wikipedia page; in particular, see the "Basic Example". As discussed in Wikipedia, given the following complete population:
2.0 4.0 4.0 4.0 5.0 5.0 7.0 9.0
then the standard deviation is
2.0
Your task is to write a C++ function StandardDev that receives an array of doubles representing a complete population along with an integer N denoting the number of elements in this array, and returns the standard deviation. The remainder of the program has been written for you and supplied below; the main() function inputs the data from the keyboard into an array, calls your function, and outputs the result. Do not modify the main() function, modify only the function StandardDev.
There is a portion of the code given below. You must fill in the blank portion of code.
Here is the code:
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
double StandardDev(double values[1000], int N)
{
double result = -1.0;
Fill in this portion without touching the rest of
code!
return result;
}
int main()
{
double value, values[1000];
int i, N;
i = 0;
cin >> value;
while (value != -1)
{
values[i] = value;
i = i + 1;
cin >> value;
}
N = i;
cout << StandardDev(values, N) << endl;
return 0;
}
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
Given a set of values representing a complete population, the standard deviation is found by taking...
Assume that arr[] is an array of 5 values. Write code within the FOR loop below so that it finds the min value in the array. You MUST use the x pointer within the FOR loop. It is the only pointer you can use. You are not allowed to made additional function calls or modify anything else within the function. Do not modify the FOR loop conditions or anything outside of the FOR loop. You must use complete C++ code...
In C++ Do not use a compiler like CodeBlocks or online. Trace the code by hand. Do not write "#include" and do not write whole "main()" function. Write only the minimal necessary code to accomplish the required task. Save your answer file with the name: "FinalA.txt" 1) (2 pts) Given this loop int cnt = 1; do { cnt += 3; } while (cnt < 25); cout << cnt; It runs ________ times ...
In C++ 9) (5 pts) Complete the following function that takes 3 arguments of a circle : - radius (input argument) - area (output argument, to be calculated) - circumference (output argument, to be calculated) All arguments are double type. If a radius is negative, the function returns false, otherwise it returns true. The function does only calculation, and does nothing else. Assume that all #include are already there // Fill in your Function prototype bool circleAreaAndCircumference ( _______,...
In C++ Write a function that accepts two int arrays of the same size. The first array will contain numbers and the second array will be filled out inside the function. The function should find all numbers in the array that are greater or equal to the average and fill out the second array with these numbers. You need to design the function. I tried this code but the errors returned were: expression must have a constant value #include<iostream> using...
Given a list of predicted values and a list of their corresponding observed values, complete the function FilterOutliers that computes the error of the data, removes outliers, and re-computes the error. The input arguments: • predicted: A double precision 10 array of size n containing the predicted values. . observed: A double precision 1D array of size n containing the observed values • threshold: A double precision positive scalar that determines if an observation is an outlier. The output arguments:...
First create the two text file given below. Then complete the
main that is given. There are comments to help you. An output is
also given You can assume that the file has numbers in it
Create this text file: data.txt (remember blank line at end)
Mickey 90
Minnie 85
Goofy 70
Pluto 75
Daisy 63
Donald 80
Create this text file: data0.txt (remember blank line at
end)
PeterPan 18
Wendy 32
Michael 28
John 21
Nana 12
Main
#include...
This is the given code:
/**
* This program uses a Taylor Series to compute a value
* of sine.
*
*/
#include<stdlib.h>
#include<stdio.h>
#include<math.h>
/**
* A function to compute the factorial function, n!.
*/
long factorial(int n) {
long result = 1, i;
for(i=2; i<=n; i++) {
result *= i;
}
return result;
}
int main(int argc, char **argv) {
if(argc != 3) {
fprintf(stderr, "Usage: %s x n ", argv[0]);
exit(1);
}
double x = atof(argv[1]);
int...
C++ Standard Deviation with arrays and vectors: #include <vector> #include <cmath> #include <iostream> using namespace std; void fillVector(vector <double> &); double average(const vector <double> &); int main() { return 0; } void fillVector(vector <double> &v) { double d; while (cin >> d) { v.push_back(d); } } double average(const vector <double> &v) { double sum = 0.; for (int i = 0; i < v.size(); i++) { sum += v.at(i); } return sum / v.size(); } standardDeviation() //stuck on this part...
I ONLY NEED PART 4 I HAVE DONE 1,2,3 Arrays This assignment is designed in small progressive parts, with the intention of developing the skill of working with arrays. Do each part separately. Include in your submission the code and output for Part I, then the code and output for Part 2, etc. into a Word document. Specification: Part 1. Write a main function that declares an array of 10 int’s. Assign each element in the array a value between...
P1) Write a complete C program that prints out the word YES, if its string command line argument contains the sequence the somewhere in it. It prints out the word NO otherwise. Both the word the and partial sequences like in the words theatre or brother qualify. Note: You can use string functions or not but if you do the only ones allowed are strcpy and strlen. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ P2) What is the output of the following program (one answer per...