question about averages
Moderator: General Moderators
question about averages
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
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
Re: question about averages
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.
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
If you're only taking 10 numbers - store the values in an array, sort it, and drop the first two
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
Re: question about averages
Good one pickle. I was approaching the problem from way too high an angle. Good work. 