Question: Starter Code: #include #define MY_PRINT(x,y,z) printf(running average is %d / %d = %.3f , x,y,z) double r_avg(int, int); int main(int argc, char *argv[]) { int

 Starter Code: #include #define MY_PRINT(x,y,z) printf("running average is %d / %d= %.3f ", x,y,z) double r_avg(int, int); int main(int argc, char *argv[])

Starter Code:

#include  #define MY_PRINT(x,y,z) printf("running average is %d / %d = %.3f ", x,y,z) double r_avg(int, int); int main(int argc, char *argv[]) { int input; int count=0; int sum=0; double resu; printf("enter number (-1 to quit): "); scanf("%d", &input); while(input != -1) { ...... ...... resu = r_avg(sum, count); My_PRINT(sum, count, resu); /* read again */ printf("enter number (-1 to quit): scanf("%d", &input); } return 0; } double r_avg(int sum, int count) { }

7.1 Specification Modify the program above, further simplifying communications between functions by using global variables. 7.2 Implementation named your program runningAveGlobal.c, which contains the main ()function define a function void runningAverage (), which computes the running average in double. Notice that this function takes no arguments and does not return anything .Put the definition of runningAverage () in another file, name the file function.c. define all global variables in function.c enter number (-1 to quit): 10 running average is 10/1-10.000 enter number (-1 to quit) : 20 running average is 30/ 2 15.000 enter number (-1 to quit) : 33 running average is 63/3 21.000 enter number (-1 to quit): 47 running average is 110/427.500 enter number (-1 to quit) :51 running average is 161 /5-32.200 enter number (-1 to quit) : 63 running average is 224 / 6-37.333 enter number (-1 to quit) :-1 red 309 %

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!