122 123
|
double total_winnings =
multiple_drop_simulator(number_of_chips, slot);
|
You have a misunderstanding that is affecting you.
The purpose of a function is to not have to worry about
global variables... like your
int winnings on line 19.
To help fix your program (and receive full credit), start by deleting line 19. Then fix the
reward() function to work without it: given a chip spot,
return a winning dollar amount.
Now, at the end of
single_drop_simulator(), you need to return the reward for landing in the given chip spot.
multiple_drop_simulator() is correct in every way:
- you have a local sum variable (line 64)
- updated by the result of a function call (line 67)
- returning its value to the caller (line 69)
Good job!
The remaining obstacles are lines 98 and 123, where you
call the functions but
completely ignore their results. We already fixed 122..123 above. What can you do for 98 (so that
winnings exists when the compiler gets to line 99)? Hint: lines 123..124.
There are a number of other things that could be corrected, but nothing you really need to fret about at this point. Good job!
Hope this helps.