Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programing in c Write a program that asks the user to enter a 10 integers and stores them in an array. Write a function (largest)

Programing in c image text in transcribed
Write a program that asks the user to enter a 10 integers and stores them in an array. Write a function (largest) that takes as input an array of int, the length of the array and a position in the array and returns the largest element of the array between the given position 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 clement starting at that position. Compile and test your program. Modify your function, change its name to largestPos and update its code so it returns the position of the largest element found. Adjust your program so it prints the largest element in the array starting at the user given position. Write a program (sort.c) that asks the user to enter a number of integers, stores them in an array, and the 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 to in the array Check if the input is between 2 and IS. If not, your program should keep asking the user to enter an integer between 2 and IS 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: (assume that the last index of the array is LAST) Find the largest element of the array (use the function written m part II) Swap the largest element with the element at position 0 find the largest element between position 1 and LAST Swap the largest element with the element at position 1 Find the largest element between position 2 and LAST Swap the largest element with the element at position 2 Repeat until all elements are sorted Print the array after sorting Compile your program, call the executable sort. Submit through the handling system the source code sort.c and the executable sort

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions