Question: Need to create this program in C. Please use basic C language not C+ Getting Started Create a new directory called lab08 under your cse220

Need to create this program in C. Please use basic C language not C+  Need to create this program in C. Please use basic C

Getting Started Create a new directory called lab08 under your cse220 directory. Implement the programs below in your lab08 directory Sorting Arrays You gradually modify your program in the three parts below so that it becomes the required sort.c Always test each complemented function thoroughly before you write another function Part I Write a program that asks the user to enter 10 integers and stores them in an array. Write a function called printArray that takes as input an array and its length and prints the content of the array separated by tabs. Modify your program so it prints the content of the array after initializing it from the user input (use the function you wrote). Write a function called largest that takes as input an array of int, the length of the array, and an index of the array and returns the largest element of the array between the given index and the end of the array. Your program should then ask the user for a position and use the function largest to return the largest element starting at that position Compile and test your program The following declaration is an example of passing an aray and its length as the parameters to a function: vold sampleFunction (int azray. int size) Part II Modify your function largest, change its name to largestPos and update its code so it returns the position of the largest element found. Change your program so it prints the largest element in the array starting at the user given position Part Ill Write a program (sort.c) using printArray and largestPos that asks the user to enter a number of integers, stores them in an array, and then sorts the array in decreasing order. Your program should do the following Ask the user to enter an integer between 2 and 15. This will represent the number of elements in the array Check if the input is between 2 and 15.f not, your program should keep asking the user to enter an integer between 2 and 15 until a valid input is entered Ask the user to enter the specified number of integers Read those integers into an array Print the array before sorting Sort the array in decreasing order using bubble sort (assume that the last index of the array is LAST): o Find the largest element of the array (use the function written in part i o Swap the largest element with the element at position0 o Find the largest element between position 1 and LAST o Swap the largest element with the element at position 1 o Find the largest element between position 2 and LAST o Swap the largest element with the element at position 2 o Repeat until all elements are sorted -Print the array after sorting

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!