467,151 Members | 951 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,151 developers. It's quick & easy.

Arrays; searching

Ok so I've got this problem for a programming class; and I can't seem to figure it out.

I've got a bunch of random numbers (say test scores). Now I need to program the code so that the user can enter a minimum and maximum score (in an input box) and then display how many matching numbers are in the range that they selected (display in a message box).

Any help, please?
Nov 16 '06 #1
  • viewed: 951
3 Replies
by the way, I'm using Microsoft Visual Studio 2005.
Nov 16 '06 #2
by the way, I'm using Microsoft Visual Studio 2005.
Hi you can copy this and make it work for your project. This is a vb6 solution;
Expand|Select|Wrap|Line Numbers
  1. 'we are assuming the the values you are checking
  2. 'are stored in arValues()
  3. Dim intLow As Integer
  4. Dim intHigh As Integer
  5. Dim intCount As Integer
  6. Dim intLoop As Integer
  8. intLow = CInt(txtLow.Text)
  9. intHigh = CInt(txtHigh.Text)
  11. For intLoop = 0 To UBound(arValues)
  12.    If arValues(intLoop) <= To intHigh _
  13.       AND arValues(intLoop) >= intLow Then
  14.       intCount = intCount + 1
  15.    End If
  16. Next intLoop
  18. 'intCount now holds the number of values in between the two user choices
Nov 16 '06 #3
Thanks for the help.

I got it working some how.
Nov 16 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Bryce Maschino | last post: by
60 posts views Thread by Dominique Léger | last post: by
9 posts views Thread by Charles Banas | last post: by
197 posts views Thread by Steve Kobes | last post: by
1 post views Thread by Scott Handojo | last post: by
7 posts views Thread by Joseph Lee | last post: by
1 post views Thread by BlackJackal | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.