CIS-251 “C++ Programming” Program #8 (Searching and SortingArrays)
1) Using Visual Studio or your selected IDE, create a C++program solution for challenge described in Step #3 below.
2) You must use good programming style as shown in the examplesin the textbook to include ample comments in your source code. Youmust include helpful information in a header block such as theprogram description, the source of your program, your name, and thedate.
3) Write a C++ program that performs specific searching andsorting exercises of an array of integers. This program has sixrequired outputs, and each must be numbered. Start by initializingan 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 thelinear, or sequential, search of the unsorted array, determine andreport the 1-relative (i.e. 1st, 2nd, 3rd, 4th, etc.) positions ofthe following numbers in the array (or -1 if not found), and thenumber of searches required to locate each of the followingnumbers: 25, 30, 50, 75, and 92.
This is required output #2 of 6. Then display the total numberof searches for all five numbers. If a number wasn’t found, thenadd in the total elements in the array for that search attemptsince they obviously were all looked at. This is required output #3of 6. Then sort the numbers using any algorithm of your choice(e.g. bubble sort, selection sort, etc.) and then display thesorted array. This is required output #4 of 6. Next, using a binarysearch of the sorted array, determine and report the 1-relativepositions of the following numbers in the array (or -1 if notfound), and the number of searches required to locate each of thesame numbers as before: 25, 30, 50, 75, and 92. This is requiredoutput #5 of 6.
Finally, display the total number of searches for all fivenumbers. This is required output #6 of 6.
Your program must only execute a single time to produce all sixresults.
CAN ANYBODY HELP ME WITH THIS HOMEWORK? I have no idea what todo.
CIS-251 “C++ Programming” Program #8 (Searching and Sorting Arrays) 1) Using Visual Studio or your selected IDE, create
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am