Question: Program already solved, but I need to put function documentation headers for each and every function in your program (for the ones you write, and
Program already solved, but I need to put function documentation headers for each and every function in your program (for the ones you write, and keep the function header I give you for the main() function). Also make sure you keep the file block header at the top of the file, and fill in the information correctly. Secondly this week you must get your indentation correct. All indentation must use 2 spaces, and you should not have embedded tabs in your program files. (I JUST NEED HELP ON GETTING THE RIGHT FORMAT of the program)
#include #include #include
using namespace std;
double calculateMean(int n, int x[]) { double sum = 0; for(int i=0; i { sum += x[i]; } return sum/n; }
double calculateStandardDeviation(int n, int x[]) { double avg = calculateMean(n, x);
double sum = 0; for(int i=0; i sum += pow(x[i] - avg, 2); }
return sqrt(sum/n); }
/** main * The main entry point for this program. Execution of this program * will begin with this main function. * * @param argc The command line argument count which is the number of * command line arguments provided by user when they started * the program. * @param argv The command line arguments, an array of character * arrays. * * @returns An int value indicating program exit status. Usually 0 * is returned to indicate normal exit and a non-zero value * is returned to indicate an error condition. */ int main(int argc, char** argv) { int n = 22; int x[] = {5, 8, 3, 7, 9, 2, 7, 5, 4, 5, 2, 1, 9, 8, 9, 3, 5, 2, 5, 8, 8, 9}; double xbar; double std;
// calculate and display mean of values xbar = calculateMean(n, x); cout << "The calculated mean is: " << setprecision(8) << xbar << endl;
// calculate and display standard deviation of values std = calculateStandardDeviation(n, x); cout << "The calculated standard deviation is: " << setprecision(8) << std << endl;
// return 0 to indicate successful completion return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
