Im using the Linux system not Windows system This is the out

I\'m using the Linux system not Windows system
This is the outline

This is input

This is the output

AT&T; 89% 10:15 cs.unh.edu DUE: 10/13/2016 CS41O FALL 2016 LAB 6 Problem Submit code: L rite a program that reads integers from a file into an array of length 100 and prints statistics 100 and prints statistics about them 1. How many values were read into the array (the file may have fewer than 100 numbers) 2. The arithmetic mean (average) of the values in the array 3. The sample standard deviation of the values in the array Your program should read data into the array until either 100 numbers have been read in (filling the array, or until end of file. Your program must define and use three functions: Reads·ntegers from standard input into the arr av parameter and int read_array( int array[] returns the number of imegers that were read into the array parameter when it finished. . double cale mean(int array), int size)-Returns the arithmetic mean of the values in the array parameter double cale-stddevi int array[], int size)--Returns the standard deviation of the values in the array parameter * In addition there is a function to print the contents of the array that would be useful, this can be the array, especialy after a called to called anytime you want to examine the contents of read array to make sure the array is filled in correctly void print arrayfint arrayll, int size Prints the contents of the array This program should not prompt for input or echo values because it is meant to accept \"batch\"imput. In other words, it is expected that it will always be run with input coming from a file, rather than from a user what your lab program should eventually do. Sample input is at Spublic 6L/in1 (and others). Solving it Step by Step typing it in. Example output of this program is available at Spublic 6Lout1 (and others) so you can see Here\'s a recommended procedure (once you\'ve logged in and set up a directory to work in for this lab). 1. Copy the starting code file Spublic/6L/stats.c to your directory. This file contains forward 2. Compile stats.c (using goc) just as a sanity check to make sure it compiles without errors 3 20 points] The first order of business will be to read in all the input and stop when the end of the declarations and empty stubs for the functions described above plus one you\'ll use for debagging. Reading until end-of-file (EOF) input file is reached. To do this, we will make use of the fact that scanreturns a value called EOF when it encounters the end of user imput (otherwise it returns how many items the user entered). Down in the read-array function, you already have a scanline provided to you that status, and then assign the result of the seantf reads one value. Create call to it: an integer variable called status-scanf-%d\", &a;[0]); 4. The read array function is intended to fill the array parameter with numbers typed by the user, and return how many numbers that was. At this point, it just reads in a single value and returns 1 The next thing you\'re going to do is to write a while loop that continues as long as the return status of scanf is not EOF. Just after the scanf line, star awhile loop: while (status-EOF) Put some braces for the body of this while loop, and let the nurn-read the first thing in the body of that loop. After this line (but before the closing brace) add a line that reads more input. For now, just copy the line-status-scanf(\"%d\", &a;(0]);\" that you modified in step 3. When done correctly, the code you have by the end of this step might be interpreted in English as follows: read a number, and as long as we haven\'t hit the end of user imput, add one to a counter and read another umber 120 points] Now go up to main, and look for the comment that says \"Read the array\". Under that comment, replace \"numbers(-0\"with a call to read-array. Assign the result of the call to the 5, that\'s already there be 6.

Solution

Here is the requred functions as per requirement

double calc_mean(int a[], int size)
   {
   int i, sum = 0;
   for(i=0,i<size,i++)
       sum += a[i];
   return sum/size;
   }

double calc_stddev(int arr[], int size)
   {
   float sum = 0.0, mean, standardDeviation = 0.0;
   int i;
   mean = calc_mean(arr, size);
   for(i=0; i<size; ++i)
   standardDeviation += pow(data[i] - mean, 2);

   return sqrt(standardDeviation/size);
   }

void print_array(int array[], int size)
   {
   int i;
   for(i=0,i<size,i++)
       printf(\"%d \",array[i]);
   }

I\'m using the Linux system not Windows system This is the outline This is input This is the output AT&T; 89% 10:15 cs.unh.edu DUE: 10/13/2016 CS41O FALL 20
I\'m using the Linux system not Windows system This is the outline This is input This is the output AT&T; 89% 10:15 cs.unh.edu DUE: 10/13/2016 CS41O FALL 20

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site