CIS-251 "C++ Programming" Program #8 (Searching and Sorting Arrays)
1) Using Visual Studio or your selected IDE, create a C++ program solution for the challenge described in Step #3 below.
2) You must use good programming style, as shown in the examples in the textbook, to include ample comments in your source code. You must include helpful information in a header block, such as the program description, the source of your program, your name, and the date.
3) Write a C++ program that performs specific searching and sorting exercises on an array of integers. This program has six required outputs, and each must be numbered. Start by initializing an array with the following integers, in this order: 23, 17, 5, 90, 12, 44, 38, 84, 77, 3, 66, 55, 1, 19, 37, 88, 8, 97, 25, 50, 75, 61, and 49. Then display the unsorted values.
This is required output #1 of 6 for this program. Using the linear, or sequential, search of the unsorted array, determine and report the 1-relative (i.e., 1st, 2nd, 3rd, 4th, etc.) positions of the following numbers in the array (or -1 if not found), and the number of searches required to locate each of the following numbers: 25, 30, 50, 75, and 92.
This is required output #2 of 6. Then display the total number of searches for all five numbers. If a number wasn't found, then add in the total elements in the array for that search attempt since they obviously were all looked at. This is required output #3 of 6. Then sort the numbers using any algorithm of your choice (e.g., bubble sort, selection sort, etc.) and then display the sorted array. This is required output #4 of 6. Next, using a binary search of the sorted array, determine and report the 1-relative positions of the following numbers in the array (or -1 if not found), and the number of searches required to locate each of the same numbers as before: 25, 30, 50, 75, and 92. This is required output #5 of 6.
Finally, display the total number of searches for all five numbers. This is required output #6 of 6.
Your program must only execute a single time to produce all six results.