CIS 275 Lab 5

Points: 25 Due Date: June 10, 2003
This will be a bit more about linked lists. You will read a sentence from a file. The file can contain the sentence on one line or on several lines. Each word in the sentence will be stored in a list object. Each word in the sentence will be separated by either a space or a newline so no parsing is needed. After the list is created, you will print it using an iterator.

Then you have to create a new list with the same words in it in reverse order. You have to read the first list in forward order, no reverse iterators. That is, the elements in the list are in reversed order, not the words in the elements. For example, if the words in the original list are:
hello joe what do you know
the reversed list would be
know you do what joe hello.
After you have created the second list, you should print it. You have to create two independent lists, traverse the one and create the other in reverse order.

New second part of the lab
Write a function that takes a list as as argument and counts the number of letters in the list. That is, for each word, figure out how many letters are in it and add all these together. Run the function for both lists and print the results.

EXTRA CREDIT (5 points):
Then you will need a function that takes the two lists and checks that the program worked. It does this by comparing the two lists and checking the same words appear in opposite order. This is probably the hard part. Then print a message whether they are the reverses of each other as well. There are several ways to do this, use your imagination.

If you have questions, just ask.