question about averages

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
Obadiah
Forum Regular
Posts: 580
Joined: Mon Jul 31, 2006 9:13 am
Location: Ashland, KY
Contact:

question about averages

Post 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
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Re: question about averages

Post 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.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: question about averages

Post by pickle »

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

Post by Charles256 »

Good one pickle. I was approaching the problem from way too high an angle. Good work. :-D
Post Reply