+1 714-215-3097

(Solved) : Write C Program Sorts Integers Provided User Input Program Keeps Asking User Integers User Q35615494

Write a C program that sorts the integers provided through userinput. The program keeps asking user for integers until userpresses ctrl-d to end stdio and finish inputs. (The function to getuser input in your program will return EOF when user pressesctrl-d.) Then, your program sorts the integers and prints out thesorted integers with one integer on each line.

To finish the program, you need to know how to handle userinputs (using functions such as scanf) and allocate memory (usingfunctions such as malloc or calloc). Read the related chapters in aC book for how to use these functions.

Modify and use the following script to test your program.


echo “================== input ======================”
while [ $i -le $1 ]; do echo $RANDOM; i=$(($i+1)); done | teeinput
echo “============= execution result ================”
cat input | YOUR_PROGRAM | tee your_output
cat input | sort -n > standard_output
echo “====== differences from correct result =======”
diff your_output standard_output

Leave a Reply

Your email address will not be published. Required fields are marked *