Project 3 Solution

$35.00 $30.80


  1. [20 points] Write a program that takes its command-line arguments and starts by printing them in reverse order.  For example, if your executable is called reverse and you run it by:

./reverse one two three

The output should be:

three two one

  1. [20 points] Adding to your program in part A, go through the command line arguments and find the largest and smallest arguments (by lexographic order). Note that you should not need to sort your arguments, but instead compare them and save the smallest and largest strings as you go through. For example, if called with ./reverse one two three:

It would display the output for part A:<br>

Three two one<br>

And then it would display<br>

The smallest string was: one<br>

The largest string was: two