Question: C Programming: Please provide explanation as you work out the code. I want to understand why the code is being used, not just view the

C Programming: Please provide explanation as you work out the code. I want to understand why the code is being used, not just view the code.

I have included project 3 that we are using for this project.

Thank you very much.

C Programming: Please provide explanation as you work out the code. I

want to understand why the code is being used, not just view

the code. I have included project 3 that we are using for

this project. Thank you very much. stocks.c: #include #include #include "io.h" #include

"stats.h" int main(int argc, char* argv[]) { int size, i; char order;

stocks.c:

#include #include #include "io.h" #include "stats.h"

int main(int argc, char* argv[]) { int size, i; char order;

// greet and get the number of stocks print_greeting(); printf("How many stocks prices would you like to analyze? "); scanf("%d", &size);

// read the data float array[size]; read_array(array, size);

// get the stats float mean = get_average(array, size); float variance = get_variance(array, size); float min = get_min(array, size); float max = get_max(array, size); float median = get_median(array, size);

// show the results print_results(array, size, median, min, max, mean, variance);

return 0; }

stats.c

#include

#include "stats.h"

// sorts the values of an array according to order

void sort (float output[], const int size, char order)

{

int i, j;

float temp;

if (order == 'a' || order == 'A')

{

for ( i = 0; i

for ( j = i + 1; j

if ( output[i] > output[j] )

{

temp = output[i];

output[i] = output[j];

output[j] = temp;

}

}

else if (order == 'd' || order == 'D')

{

for ( i = 0; i

for ( j = i + 1; j

if ( output[i]

{

temp = output[i];

output[i] = output[j];

output[j] = temp;

}

}

else

return;

}

io.c

#include #include "io.h"

// prompt the user for input and read the values into an array void read_array(float array[], int size) { int i = 0; for (i = 0; i

// say hi to the user void print_greeting(void) { printf("you put whatever greeting you want here "); }

// display array values void print_array(const float array[], int size) { int i = 0;

for (i = 0; i

printf(" ");

}

// print the stat results including input data void print_results(const float array[], int size, float median, float min, float max, float mean, float variance) {

printf(" Say something here about the ouput "); print_array(array, size); printf("median: $%.2f ", median); printf("min: $%.2f ", min); printf("max: $%.2f ", max); printf("variance: $%.2f ", variance); printf("mean: $%.2f ", mean);

}

1. Create a folder with the name lastname_initials-proj4- all lower case. 2. put inside it these files: Makefile, stocks.c, stats.c,io.c, io.h, stats.h, utils.h, utils.c

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!