Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Seven NoSQL Databases In A Week Get Up And Running With The Fundamentals And Functionalities Of Seven Of The Most Popular NoSQL Databases

Authors: Aaron Ploetz ,Devram Kandhare ,Sudarshan Kadambi ,Xun Wu

1st Edition

1787288862, 978-1787288867

More Books

Students also viewed these Databases questions

Question

Name the bones of the cranium and the facial skeleton.

Answered: 1 week ago