You are to complete a program that reads in a number of words as strings, such as a sentence, and then outputs the words in different orders. There are two procedures, called ForwardPrint and ReversePrint, that do the printing. Each procedure takes three arguments. The last argument is the array of strings. The first two arguments indicate the part of the string array to print, i.e., print the strings from Strings(StartIndex) to Strings(EndIndex) or in reverse, depending on the procedure.
Copy the file ``/usr/copy/aps105/revstring.t'' into your working
directory and rename it ``part1.t''.
A listing of this file is given in Appendix A starting
on page .
Complete the two procedures ForwardPrint and ReversePrint. You are to write ForwardPrint using a loop and ReversePrint as a recursive procedure.
Assume that only legal inputs are entered.
You should only write the code for the procedures. Do not change any other part of the program when you submit your solution, though you are free to make modifications while testing. Just make sure that the program you submit has the original code.
An example of the input sequence is:
Input String, end with `end' Be careful driving elephants in small flimsy garages. end
Go here to see a solution.