Define stubs for the functions called by the below main(). Each stub should prin
ID: 3827895 • Letter: D
Question
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:
c++
_________________________________________
#include <iostream>
using namespace std;
/* Your solution goes here */
int main() {
int userNum1 = 0;
int userNum2 = 0;
int avgResult = 0;
userNum1 = GetUserNum();
userNum2 = GetUserNum();
avgResult = ComputeAvg(userNum1, userNum2);
cout << "Avg: " << avgResult << endl;
return 0;
}
Explanation / Answer
#include <iostream>
using namespace std;
int GetUserNum()
{
cout <<"FIXME: Finish GetUserNum()" << endl;
return -1;
}
int ComputeAvg(int n1, int n2)
{
cout <<"FIXME: Finish ComputeAvg()" << endl;
return -1;
}
int main() {
int userNum1 = 0;
int userNum2 = 0;
int avgResult = 0;
userNum1 = GetUserNum();
userNum2 = GetUserNum();
avgResult = ComputeAvg(userNum1, userNum2);
cout << "Avg: " << avgResult << endl;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.