BASIC Programming
Chapter 10 Programming Assignment
|
Specs
Write a program to generate 100 random integers between
and including 1 and 1000. Store the numbers in an array. Use a comb sort
(see p. 394 for a model) to put the numbers in ascending order. The random numbers
should be generated and sorted within the array during the Form_Load event.
Display the numbers on the form in a listbox with the Sorted property set to
False. Provide a command button that allows the user to search for an integer
between 1 and 1000. Use an InputBox to obtain that number and use a binary
search to look for that number within the array, displaying its position
in a label if it's found in the array. If it is not found in the array the message
"not found" should appear in the label. If the number appears in the
array multiple times, only its first occurrence needs to be displayed. The program
must allow the user to look for different numbers until he or she enters the
sentinel value 0 in the InputBox to stop the program. A binary search algorithm
is presented on p. 407 but you may have to modify it to compare values rather
than strings. That is, try not to use the StrComp function.
The program must follow the Documentation
& Coding Standards. Save the project as well as all form and/or code
modules as Ch10Prob2JD, where JD are your initials.