Njn B.

asked • 01/17/21

Ans this question in C?

(C ONLY) I am having issues with coding this is what I have currently

The program expects the name of an input file and an output file to be given by the user. If

the user does not input any names, default file names should be used, such as input.txt

and output.txt. The input files have lines which look like this:

3 Tester College; 1909 33001

The first number represents the rank; it is followed by the school name, year founded,

and approximate number of students.

Read the list of colleges into an array of structures. You may assume that the maximum

size of a college name string is 64.

The program should use either the insertion sort algorithm or the selection sort algorithm

to sort the array in descending order by rank.

Display any k consecutive schools requested by the user. For instance, if the user enters 1

2, the program displays the first 2 schools in a readable format of your choice. If the user

enters 1 5, the program displays the first five schools, if the user enters 2 7, display 7

schools beginning with the one at index 1 (2 - 1), and so on. Repeat this process until the

user enters 0 0. Reject invalid input (such as -1 5, or 1 200, etc.)

Finally write the sorted array to the output file, using the same format as in the input

file's format.


input.txt

3 Tester College; 1929 33001

5 Aponoeo College; 1964 22300

9 Arizona College; 1942 4000

7 Westside College; 1972 9506

2 Apollo College; 1917 25300

8 Sidester College; 1947 4760

4 Diablo Valley College; 1939 24781

6 Foothill College; 1947 18362

1 College of the Herch; 1957 24712

10 Quelsa College; 1953 19571


1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.