(Solved):Write a program that sort its command-line arguments of 10 numbers, which are assumed to be integers. The first command-line argument indicates whether the sorting is in descending order (-d) or as… View Answer…

 

Question

Write a program that sorts its command-line arguments of 10 numbers, which are assumed to be integers. The first command-line argument indicates whether the sorting is in descending order (-d) or ascending order (-a). If the user enters an invalid option, the program should display an error message. Example runs of the program:

./sort -a 5 2 92 424 53 42 8 12 23 41 output: 2 5 8 12 23

Scroll to top