Question: i need help with this program, I am stuck at it /* My typedef structures from a different file */ Typedef struct { Char name[21];

i need help with this program, I am stuck at it

/* My typedef structures from a different file */

Typedef struct {

Char name[21];

Double attempts[N_ATTEMPTS];

Double personal_best;

Double deviation;

}jumper_t;

Typedef struct {

Double average_of_best;

Double winning_jump;

}stats_t;

Pseudocode

/*-------------------------------------------------------------*/

main

out_file = open_out_file ();

get_data(IN_FILENAME, jump_list);

get_stats(jump_list, &jump_stats);

print_all(out_file, jump_list, &jump_stats);

/*-------------------------------------------------------------*/

FILE * open_out_file(void) /* It already exists */

/*-------------------------------------------------------------*/

void get_data (char *filename, /* input */

jumper_t jump_list[NCOMPETITORS] ); /* output */

/*It already exists */

/*-------------------------------------------------------------*/

/* The print_all SUB-FUNCTION is provided for you */

void print_all(FILE * out_file, jumper_t jump_list[NCOMPETITORS] , stats_t *jump_stats )

/* It already exists */

/*-------------------------------------------------------------*/

CSC 60. Spring 2017. Lab 8 arrays & structures.

Page 3 of 5.

/*--------------------------------------------------------------------------------*/

/* THIS IS A SUB-FUNCTION THAT YOU HAVE TO WRITE */

void get_stats( jumper_t jump_list[NCOMPETITORS], /* in & out */

stats_t *jump_stats ) /* in & out */

{

Zero out the average_of_best. (HINT: use the -> notation)

Zero out the winning_jump.

Loop from r=zero to r< NCOMPETITORS increment by one

{

set the jumper's personal_best to the jumper's first jump

loop from c=one to c< N_ATTEMPTS increment by one

{

figure the jumpers personal_best jump(use an IF)

}

add the jumper's personal _best jump into the running total average_of_best

loop from c=zero to c< N_ATTEMPTS increment by one

{

figure the winning_jump (use an IF)

}

} /* end of the loop, r< NCOMPETITORS */

compute the average of the best jumps

loop from r=zero to < NCOMPETITORS increment by one

{

figure the jumper's deviation from the winning_jump

(deviation is: winning_jump - jumper's personal_best jump)

}

return

} /*-------------------------------------------------------------*/

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!