
Originally Posted by
Bamaboy53
Help!
I copied and pasted your code into a Visual Studio 2005 command-line project and it worked for me with ad-hoc int number entry for sets of 5, 10, and 20 numbers. So, what set of numbers did you enter that didn't provide the correct average?
A typical gotcha with this type of thing is dividing ints and not properly casting and the result getting truncated somewhere in the operation. Also, program fails ungraciously if something other than an int is entered. Input validation is a critical feature of any real-world application. Best to get in the habit.