Answered step by step
Verified Expert Solution
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
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 aboveStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started