Define stubs for the functions called by the below main().

Define stubs for the functions called by the below main(). Each stub should print “FIXME: Finish FunctionName()” followed by a newline, and should return -1. Example output:

FIXME: Finish GetUserNum()
FIXME: Finish GetUserNum()
FIXME: Finish ComputeAvg()
Avg: -1

Sample program:
#include <stdio.h>

<STUDENT CODE>

int main(void) {
   int userNum1 = 0; 
   int userNum2 = 0;
   int avgResult = 0; 

   userNum1 = GetUserNum();
   userNum2 = GetUserNum();

   avgResult = ComputeAvg(userNum1, userNum2); 

   printf("Avg: %dn", avgResult);

   return 0;
}  

Answer

//Define stubs for the functions called by the below main(). Each stub should print “FIXME: Finish FunctionName()” followed by a newline, and should return -1. Example output:
// FIXME: Finish GetUserNum()
// FIXME: Finish GetUserNum()
// FIXME: Finish ComputeAvg()
// Avg: -1
#include <stdio.h>
int GetUserNum(){
printf(“FIXME: Finish GetUserNum()n”);
return -1;
}
int ComputeAvg(int n1, int n2){
printf(“FIXME: Finish ComputeAvg()n”);
return -1;
}

int main(void) {
   int userNum1 = 0;
   int userNum2 = 0;
   int avgResult = 0;    userNum1 = GetUserNum();
   userNum2 = GetUserNum();    avgResult = ComputeAvg(userNum1, userNum2);    printf(“Avg: %dn”, avgResult);

   return 0;
}

Leave a Comment