Question: This is to be coded in in C language using fixed length arrays. Problem: Sorting can be completed in either ascending (smallest value at index
This is to be coded in in C language using fixed length arrays.


Problem: Sorting can be completed in either ascending (smallest value at index zero) or descending (largest value at index zero) order. Sorting based on numeric value has already been implemented in the notes and C programming text used within the course. For this assignment the user may enter up to 25 positive integer values, can request the data be sorted either ascending or descending order, and lastly select one of two ways they would like the data to be sorted. Sorting method #1: By Number of Digits Example Data Set: 8, 70, 650, 51, 4, 33, 210, 1234 * Sorted by number of digits (ascending): 4, 8, 33, 51, 70, 210, 650, 1234 . Of those numbers with the same number of digits we will sort them numerically. Sorting method #2: Lexicographically https://en.wikipedia.org/wiki Lexicographical order Example Data Set: 8, 70, 650, 51, 4, 33, 210, 1234 * Sorted lexicographically (ascending): 1234, 210, 33, 4, 51, 650, 70, 8 Example Execution #1: Enter (1) to sort by number of digits or (2) to sort lexicographically: 1 Select (1) to sort ascending or (2) for descending: .2 Enter up to 25 positive integer values or -1 to exit: 10 20 30 40 11 21 31 41 5 4321-1 Sorted results: 41, 40, 31, 30, 21 20, 11, 10, 5, 4 3, 2, 1 Example Execution #2: Enter (1) to sort by number of digits or (2) to sort lexicographically: 2 Select (1) to sort ascending or (2) for descending: 2 Enter up to 25 positive integer values or -1 to exit: 1 21 121 313 211 13 2-1 Sorted results: 313, 211, 21, 2, 121 2, 13 Example Execution #3: Enter (1) to sort by number of digits or (2) to sort lexicographically: 1 Select (1) to sort ascending or (2) for descending: 1 Enter up to 25 positive integer values or-1 to exit: 54 515 505 543 5150 54321 5432 54320 5430 5 -1 Sorted results: 54 505 515 543 5150, 5430, 5432, 54320, 54321 Example Execution #4: Enter (1) to sort by number of digits or (2) to sort lexicographically: 2 Select (1) to sort ascending or (2) for descending: 1 Enter up to 25 positive integer values or -1 to exit: 1 11 12 101 111 121 122 110 -1 Sorted results: 1, 101, 11, 110, 111 12, 121, 122
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
