Page 1 of 1

question about averages

Posted: Mon Jan 11, 2010 8:05 pm
by Obadiah
ok...im working with Visual Basic...and what i generally want to do with this program is call an input box that will ask the user for 10 numbers ranging anywhere from 1-100, average them, and store the numbers in a text file...i got that part all bagged up....but now...i want to drop the lowest 2 numbers to that its only averaging and writing 8 to the file instead of the full 10

Re: question about averages

Posted: Tue Jan 12, 2010 8:09 am
by Charles256
http://www.google.com/search?q=find+sma ... =firefox-a

that should bring up algorithms for finding the smallest number in an array. Maybe add Visual Basic to the search string to help out. It's a pretty common and basic CS task so you should find dozens of examples. Let me know what you get stuck on, if anything.

Re: question about averages

Posted: Tue Jan 12, 2010 11:57 am
by pickle
If you're only taking 10 numbers - store the values in an array, sort it, and drop the first two

Re: question about averages

Posted: Tue Jan 12, 2010 2:41 pm
by Charles256
Good one pickle. I was approaching the problem from way too high an angle. Good work. :-D