Question: 2 (50%) write a program to compute the mean and standard deviation of a given sequence of numbers. Assume (x,x2,x3.. xn) is the sequence. The
2" (50%) write a program to compute the mean and standard deviation of a given sequence of numbers. Assume (x,x2,x3.. xn) is the sequence. The mean of the sequence is x2xn). Alternatively, we can write it as - The standard deviation of the sequence iso-pr '/lai-r74(Xy-r)2 + + (x Larry Alternatively, we can write it as - where is the mean. Requirements (1) Your program must read the data from the file "sequence.txt". The first number of the file is an integer that tells you the length of the sequence. For example, if it's 30, then it means there are 30 numbers in the sequence (n 30). The remaining numbers are the elements of the sequence. (2) You must either display the mean and standard deviation on the screen, or (3) You must use a dynamic array with a pointer, so that your program can adapt (4) You must write a function to compute the mean, and another function to save them to a file. to different lengths of the sequence. compute the standard deviation. The main function should not have any computation. (5) You must implement the above functions in a header file (hpp), and use the include command to include it in your main source code (cpp). You cpp file should have only 1 function, which is the main function. Hints: (1) You can use power function powO and square root sqrtO.You must include (2) You can refer to the examples file 10 and struct Example 2in D2L to learn how (3) Read Page 20 to 21 on the slides of Lecture 5 to find how to declare a dynamic (4) There are three test samples for you. The first test sample has 3 numbers. The
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
