Finding numbers surrounding...
I have an array of integer, when the user inputs a certain number called NUM and a range for me to search, I will have to output all the numbers within the range around NUM....
Could you tell me your ideas about how to solve this kind of problem ?:)
Any help/ideas are really appreciated...
-hometown
Re: Finding numbers surrounding...
Quote:
Originally posted by hometown
I have an array of integer, when the user inputs a certain number called NUM and a range for me to search, I will have to output all the numbers within the range around NUM....
Could you tell me your ideas about how to solve this kind of problem ?:)
Any help/ideas are really appreciated...
-hometown
Loop through the array one element at a time, check each element's value to see if it is in range, and output it if it is.
Re: Re: Finding numbers surrounding...
Quote:
Originally posted by gjs368
Loop through the array one element at a time, check each element's value to see if it is in range, and output it if it is.
Thanks GJs386 very much for your idea...
But do you know any other ways to resolve that problem ?
Supposing I have an array like array[BIGGESTNUMBER] and the range to search is extremely LARGE and then my small computer's memory will not be able to afford that way to search the whole stuff, right ?:(
Thanks again,
Fiona