• Make use of a menu system to call various functions
  • Make use of multiple sorting, and searching techniques
  • Make use of arrays


In this lab you will be coding a program that will make use of functions to search and sort an array. There will also be a print method, again complete with a full menu system. The Menu options are listed below in the section labeled “menu.”

You will need to set up a hundred (100) position integer (int) array that is defined globally. You will also need a global integer (int) variable called size. By doing this, you will not have to pass the Array and the size to each method you write. If you do not declare these variables globally, then they will have to be passed back and forth through your methods. Pick one method or the other. Do NOT do both (IE declare them globally and still pass them back and forth.)

Note: A Sample main method is provided at the bottom of this document. Yours may look slightly different than the one provided.


The menu should have the following eight options:

1. Set the size of the array
2. Fill the array with random numbers (1 – 100)
3. Print the array
4. Sort the array in ascending sequence
5. Sort the array in descending sequence
6. Sequential search of the array for a
7. Binary search of the array for a target
8. Exit (this can be option zero if you prefer)

From these eight Options, one can see that seven methods will be needed. Each of the seven main functionalities above will need a function that does what they say.

Set size will change the global size value so that the user can pick how many values they want to use. This number cannot go beyond 100 (since 100 is the max size of the array)

When printing the array, it is required to print the position number alongside the value. Please start your positions at zero, and not one.

When doing the sorting methods, please use two different sorting algorithms. (IE, use a Min Max sort for ascending and an enhanced bubble for descending.)

For the Searching methods: you should ask for the target (number the user is searching for) in the dispatch method. Then pass the target to the search method. The search method should return the position it was found at (0 – Size) OR -1 if it was not found. Then have the appropriate messages print inside of the dispatch method.

You could write another function that does this part if you wish to keep your dispatch method cleaner and more organized. But that is up to you.


The running steps for this program are more ‘extensive’ then they have been in previous labs. Please follow the steps closely, and use the values specified. The numbers in (parenthesis) are the options if you set up your menu in the order listed above.

  • Ask the user for the size of the array (Option 1) – use 15 as size of array in this run
  • Fill the array with random values (Option 2)
  • Print the array (Option 3)
  • Sequentially search the array for a number in the array, and then search again for a number that was not in the array. (Option 6, Option 6)
  • Sort the array into ascending sequence (Option 4)
  • Print the array again (Option 3)
  • Do a binary search of the array for a number in the array, and then search again for a number that was not in the array (Option 7, Option 7)
  • Sort the array into descending sequence (Option 5)
  • Finally, print the array for the third and final time (Option 3)


You will need to turn in your source code printed from Visual Studio, as well as your runs as described above. Staple them in that order.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.