Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Linux C programming First: Array and Sorting (10 Points) You have to write a program that wil read an array from a file and sort

Linux C programming

image text in transcribed

First: Array and Sorting (10 Points) You have to write a program that wil read an array from a file and sort the given array. You will return the array sorted with al even numbers in ascending order at the front followed by all odd numbers in descending order. You may assume that input array will not have more than 20 elements (i.e, ax size is 20) You can use any sorting algorithm you know or wish to use. However, you cannot use the library sort functions. You should write your own sort function Input-Output format: Your program will take the file name as input. The first line in the file provides the total number of values in the array. The second line will contain a list of numbers separated by tabs. For example a sample input file "filel.txt" is: 25 10 1 99 42 Your output wi be the sorted list of numbers, even numbers (ascending) and then odd nm bers (descending), each separated by tabs $./first file1.txt 2 4 10 99 25 1 We will not give you improperly formatted files. You can assume all your input files will be in proper format as above

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

Power Bi And Azure Integrating Cloud Analytics For Scalable Solutions

Authors: Kiet Huynh

1st Edition

B0CMHKB85L, 979-8868959943

More Books

Students also viewed these Databases questions

Question

List the advantages and disadvantages of the pay programs. page 505

Answered: 1 week ago