Solved–Project 3– Solution

$35.00 $24.00

A. [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 B. [20 points] Adding to your program in part A, go through…

You’ll get a: . zip file solution

 

 
Categorys:
Tags:

Description

5/5 – (2 votes)

A. [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

B. [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>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Three two one<br>

And then it would display<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The smallest string was: one<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;The largest string was: two