Help with defining function problem!

Dec 1, 2014 at 9:20pm
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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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>
using namespace 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;
}  
Dec 2, 2014 at 12:47am
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?
Dec 2, 2014 at 12:55am
Return value will be helpful.
Last edited on Dec 2, 2014 at 1:06am
Dec 2, 2014 at 1:00am
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 :)
Dec 2, 2014 at 3:55am
I have specific questions on how exactly to figure this function out.
Topic archived. No new replies allowed.