Thank you
Thank you
Last edited by lifeis2evil; 11-13-2007 at 06:02 PM.
The names of the functions should give you hints. The display function is only there to display the values. It's getAndCalcAverages's job to calculate the average. Note that you got the return type wrong. It's supposed to be float - it's supposed to be the average.
That's why display has four parameters: the three numbers plus the average.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Well given the prototype, maybe you're supposed to pay attention to the return result,
avg = getAndcalcAverages(firstNumber,secondNumber,thirdN umber);
And perhaps avg is the 4th float passed to display()
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Thank you
Last edited by lifeis2evil; 11-13-2007 at 06:02 PM.
No. Did you even change anything?
You have to calc the averages in the function that has "calcAverages" in its name.
And you have to return it.
All the buzzt!
CornedBee
"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
Thank you
Last edited by lifeis2evil; 11-13-2007 at 06:02 PM.
You have to do more work. You have to change the return type of the function. You also have to use the returned value.
Do you remember how to use functions that return values? Go back to your book/notes/reference and brush up on the details.
Thank you
Last edited by lifeis2evil; 11-13-2007 at 06:03 PM.
Looks better.
Now to remove that conio dependency, and you're all good to go.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.