Arrays help?

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2008
Posts: 14
Reputation: asif786 is an unknown quantity at this point 
Solved Threads: 0
asif786 asif786 is offline Offline
Newbie Poster

Arrays help?

 
0
  #1
Jan 22nd, 2009
i am using vb dot net 2003.

I want to store randomly generated numbers in an array. The Numbers are declared as integers. The amount of numbers generated will not be constants so i can not initialize the array before hand. However the numbers generated will be from 1 to 5000.

After the randomly generated numbers are generated i will ask the user to input a "number" , then i will check using a loop if the number stored in the above mentioned array (the one which holds the randomly generated numbers) matches the value input. i know i have to use a loop. But do notknow how this would be done.
i can not figure out how to do this please help. thank you.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Arrays help?

 
0
  #2
Jan 22nd, 2009
Look my friend I don't know how you don't know the size of array and you said you will generate some number, so tell me when you'll stop generating numbers? Any way I know you question is away from this.
Your question answer is
  1. For index As Integer = 1 To YourArray.Length
  2. 'Your search algorithm resides here
  3. Next
It'd work whatever you know the size or not and if you changed its size at runtime.
Hope I got more from you best of luck
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 14
Reputation: asif786 is an unknown quantity at this point 
Solved Threads: 0
asif786 asif786 is offline Offline
Newbie Poster

Re: Arrays help?

 
0
  #3
Jan 22nd, 2009
Originally Posted by RamyMahrous View Post
Look my friend I don't know how you don't know the size of array and you said you will generate some number, so tell me when you'll stop generating numbers? Any way I know you question is away from this.
Your question answer is
  1. For index As Integer = 1 To YourArray.Length
  2. 'Your search algorithm resides here
  3. Next
It'd work whatever you know the size or not and if you changed its size at runtime.
Hope I got more from you best of luck
but how would i store the generated numbers in an array. lets say number is stored in variable called numbers and is declared as an integer. how would i get it to store randomly generated numbers into array as they are generated.

please help thanks.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: Arrays help?

 
0
  #4
Jan 23rd, 2009
OK, show me to where you reached, post some code to know how can I do the next step.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC