purpose:
Understand the command line argument, its usage, and applications
Instruction:
Write a program, named
sortlist,
that reads two to fourintegersfrom the command linearguments
and returns thesorted list of theintegers on the standard output screen. You need to use
strtol()
function to convert a string to a long integer.For instance,
>sortit3 5
>The sorted listis 3, 5.
>sortit 3 5 7
>The sorted listis 3, 5, 7.
>sortit 4 0 9 89
>The sorted list is 0,4, 9, 89
>sortit 1 p 9
>sortit: invalid input p.
>sortit
>usage: sortitnum1num2num3!
Things to submit:
1. The source code of a c file
2. Screenshots(20%) thatshowsuccessfulexecution of the testing cases such as 1. invalid input, 2. wrong usage (not enough arguments)
3. You need to use a command-line argument method. (30%)
4. Include format error checking, and input validation is required. (10%)
5. Follow the coding format as the above example.
PLEASE READ THE INSTRUCTION VERY CAREFULLY AND IF ANY PROBLEM PERSIT DON’T HESITATE TO INFORM ME. PLEASE AND THANK YOU.