Jul 22, 2018 at 7:11pm Jul 22, 2018 at 7:11pm UTC
I am supposed to get numbers from an input file and display the average. The problem is I keep getting 0 as my average and that's incorrect.
Last edited on Jul 22, 2018 at 11:33pm Jul 22, 2018 at 11:33pm UTC
Jul 22, 2018 at 7:57pm Jul 22, 2018 at 7:57pm UTC
Nowhere do you increment counter, or call calcAvg().
Jul 22, 2018 at 8:18pm Jul 22, 2018 at 8:18pm UTC
As Ganado said:
*You need to increment counter
in your readFile
function, inside the while loop.
*You need to call calcAvg
in your main function after readFile
and before closeFile
Jul 22, 2018 at 9:16pm Jul 22, 2018 at 9:16pm UTC
however, I don't understand exactly what you mean by calling it in my main function, I thought I had already called it here:
Last edited on Jul 22, 2018 at 11:34pm Jul 22, 2018 at 11:34pm UTC