7. [Extra Credit]: write a program that asks the user for the size of an array, then reads a number of integer values (f

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

7. [Extra Credit]: write a program that asks the user for the size of an array, then reads a number of integer values (f

Post by answerhappygod »

7 Extra Credit Write A Program That Asks The User For The Size Of An Array Then Reads A Number Of Integer Values F 1
7 Extra Credit Write A Program That Asks The User For The Size Of An Array Then Reads A Number Of Integer Values F 1 (91.06 KiB) Viewed 14 times
7. [Extra Credit]: write a program that asks the user for the size of an array, then reads a number of integer values (from user input) into the array. No points for that part - it's pretty much the same code as you need for problem (3). Write a function to print out the array and call it to print the array out after all values are read in - basically use your code from question (2), reused. Write a function to implement Insertion Sort and run it on the data array to sort the array (3 pts). Write another function to implement Selection Sort and run it on the data array (3 pts). Print out the array before and after each sort. NOTE: sort the items in DESCENDING ORDER. Biggest first, smallest last. The function prototypes are: void show_array (int data[ ], int n); void InsertionSort (int data[ ], int n); void SelectionSort (int data[ ], int n); where data[] is the array and n is the size of the array. If you implement both sort routines you will need to make a copy of the original unsorted array before using the first sort, or else the second sort will be working on a sorted version of the array. As with all extra credit problems, work on your own. If code is shared between two students, both receive zero points on the problem. If code comes from some other source (the web, for example) that is plagiarism and the student will receive zero points for the whole lab (not just this problem).
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply