Question: this is statistics.c that i need to modify and this is getInput.c 1. Add functions that computes summary statistics to file statistics.c 2. Add prototypes




this is statistics.c that i need to modify

and this is getInput.c
1. Add functions that computes summary statistics to file statistics.c 2. Add prototypes of the above functions to statistics.h 3. Format output using printf0 of the summary statistics - so it looks pretty. Currently the program reads in a stream of integers from standard input, example, here input03.txt is read as standard input: Example: runProgram 2.50 as a running average, but not in the proper output format. Below is the output of the program before starting. The content of input04.txt is listed by the cat command below: { csci-odin:ingrid:86\} cat input04.txt 2 4 1 3 XXX Output below for input04.txt file (In your screenshoot you need to generate the Summary statistics for input100.txt). Run the date command after program completes in your screenshot. Only getlnput.c and statistics.c and statistics.h need to modified. In getinput.c you only modify the function driver0. In statistics.c you will add a function per statistic measure. In statistics.h you will add the protoypes for each of the statistics. double running_average ( int add_number) \[ \begin{array}{ll}\text { static double total_numbers } & =0 ; \\ & \text { static double total_sum } \\ & \text { total_sum }=\text { total_sum }+\text { (double) add_number } ; \\ & \text { total_numbers }+=1 ; \\ & \text { return total_sum } / \text { total_numbers; }\end{array} \] \#include \#define MAX_LINE 80 // functions from statistics.c, prototype is in statistic.h \#include "statistics.h" /* --- * getintegerLine() returns a positive integer from a line of input Assumption: assumes proper input. */ \{ char line[MAX_LINE]; int return_user_int =1; fgets( line, sizeof( line), stdin ); while( sscanf( line, "\%d", \&return_user_int ) != 1) \{ // Not a positive integer - indicates end of input return 1; \} return return_user_int; \} void driver() \{ int anumber =1; promptList(); while ( (anumber = getintegerLine ())>=0) \{ printf( "Entered %d ", anumber ); printf( "Running Average %4.21f ", running_average( anumber ) ); printf( "End of input "); \}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
