I need help with defining a function problem for my online assignment. The assignment was due weeks before, I just need the answer so I can help study for my upcoming exam. Any help is appreciated, and I only need the <student code> portion of the code.
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 <iostream>
usingnamespace std;
<STUDENT CODE> // only need this portion of the code for the program to compile on my online text book.
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;
}
Looks like you need two functions - one to get an integer from the user and return it to main, and the other to take in two integers and return their average to main?
I'd suggest helping people with tips and pointers if they have specific questions instead of doing the homework for them. We're not going to be there to do the work for them when they take the exam, so they need to learn how to approach and solve problems on their own :)