Define a structure called Pagent that stores contestant no, first and last name, country, their scores (a floating-point array that stores 5 judges score), a floating-point array stats that stores statistics such as average, highest score and lowest score. Define a function AddPerson that will accept a pointer to an array of Pagent. The function should enter contestant details (names, country and the judges scores) into the array using pointer notation. The first contestant number begins with 200, and is incremented by 1 for each member following. The function should allow the user to add only one or more Contestant as they wish.
What part(s) are you having a problem with? Code: #define INIT_PAG_NUM 200 typedef struct { /* add vars as required */ } pagent; void addPerson(pagent *); /* function prototype */ int main(void) { ... bits of code } Based on what you've posted, the function would probably need a control loop, so that the user could enter data for as many contestants as wanted. Code: void addPerson(pagent *tmp) { loop(while user wanting to add data is true) { /* pointer notation (tmp + current_index)->member_field */ } } that loop should also check against current_index being valid for the maximum number of contestants... you don't want to add data to a record that doesn't exist even if the user insists on trying.
k k can u tell me this programm it s immediately so.......... 1) write a cprogeamm that will be the value x and evaluate the following function? y=1 for x>0 y=0 for x=0 y=-1 for x<0
1) write a cprogeamm that will be the value x and evaluate the following function? y=1 for x>0 y=0 for x=0 y=-1 for x<0
Code: y = myfunction(x); y = x > 0 ? 1 : x == 0 ? 0 : -1; you could write a function and pass x as a parameter, evaluate it inside of the function body and then return the appropriate value. you could use the ternary operator to evaluate it too, or even an if / else if / else structure.