Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

My program is still incorrect PLEASE READ ALL INSTRUCTIONS First thing I would do is fix the mean function. There is a syntax error in

My program is still incorrect PLEASE READ ALL INSTRUCTIONS
image text in transcribed
image text in transcribed
image text in transcribed
First thing I would do is fix the mean function. There is a syntax error in the body of the function. Next, I would call the mean function from main and make sure it's working correctly. Then look at the standard deviation function. x is supposed to be equal to the mean, so you'll have to have the mean of the numbers before you calculate the standard deviation. As it stands now, x doesn't have anything useful in it. If you don't assign a value to a variable before you use it, it will just contain whatever garbage is in the memory the variable occupies. x needs to have the mean in it. Also, the ^ symbol will not raise a base to an exponent. Look up the pow function from the cmath library. It is discussed in the "Using Predefined Functions in a Program" section of Chapter 3 and the "Predefined Functions" section of Chapter 6. Once you've got it straightened out, add a call to your standard deviation function to main. Make sure it is also working correctly. Done delmarlearning.com AAC Instructions main.cpp include #include Instructions Write a program that takes, as input, five numbers and outputs the mean (average) and standard deviation of the numbers. If the numbers are X, X, X, Xa, and Xs. then the mean is: using na std; double int 2, double x x x +5)/ x = (X + Xg+ Xe+ Xa+Xe 5 double sto int x2, in and the standard deviation is: s={{9-x)2+(x2-x)+(X- x)2+(Xx-x2+(X5-X12/5) double x doubles (x-x)" (x3-x)2 x5-x)2) xt, x5; Your program must contain at least the following functions: a function that calculates and returns the mean and a function that calculates the standard deviation @ 2 #include 3 the 7 8 9 4 using namespace std; 5 double mean(int x1, int x2, int x3, int x4, int x5) 6 { double x; x = (x1+x2+x3+x4+x5)/5 return x; 10) 11 double std (int xi, int x2, int x3, int x4, int x5) 12 { 13 double x; double s = sqrt (((x1-x)^2+(x2-x)^2+(x3-x)2+(x4-x)^2+(x5-x)2) /5). 15 ) 16 int main() { int x1, x2, x3, x4, x5; 18 cout > x1>>2>>3 >>x4> >5; 14 17 t the nda ard cout

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

Web Database Development Step By Step

Authors: Jim Buyens

1st Edition

0735609667, 978-0735609662

More Books

Students also viewed these Databases questions