Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In C languange NOT C++ write a program that reads numbers from a file, sorts the

ID: 3559070 • Letter: I

Question

In C languange NOT C++ write a program that reads numbers from a file, sorts the numbers in numerical order from highest to lowest values (descending order) or vice versa (ascending order), and finally write the sorted numbers in another file. The input file will contain the number of elements in the file, type of sorting required (a or d), and the numbers.

In your program, you should follow the steps below:
i) Read the number of elements in the file  

ii) Read the type of sorting (ascending or descending)  

iii) Create anarray to store the numbers (size must be equal to the number read from the file)  

iv) Sort the array  

v) In the output file, please first write the number of elements, and the numbers in the desired order.

Explanation / Answer

I write the code taking below input as sample

d
10,
25,100,
30,75,
125,120,

first line contained the sorting order. (a =ascending and d =descending)
all next lines contained data which is separated by coma.

input data can also be like this

a
10,
25,
100,
30,
75,
125,
120,

Or like this

d
10,25,100,30,75,125,120,

This is the output of program

Count of Numbers = 7
Order of Sorting = Ascending

125,120,100,75,30,25,10,

you can download all files including source file, .exe file, input and output file

from this link "http://www34.zippyshare.com/v/66325124/file.html"
I completed your all requirements. I hope you like it