lab9.dvi CS105 Lab 9 Due 12:30 11/21/97 This lab involves several functions and a class that involve the stream and list types discussed in lecture last Friday . You should create one pro ject with your answers to all of these questions, but divide up the answers themselves into different files within the pro ject. Your main function should demonstrate your answers to all of the questions. 1. Write a function that reads in words from cin (using the >> operator with a cpstring variable will make cin produce one word at a time) until it reads the word \end", and then outputs the length of the longest word (you may assume that no two words will have the same length). For example, if we type in \bison telephone baseball end", it should print out 9. 2. Write a function that opens the file named \lab9-input", and reads in all the words (until the word \end"), and tells us what the longest word is. That is, if the file \lab9-input" contains the words \bison telephone baseball end", this program should print out something like \the longest word is telephone". 3. Write a function that tests to see if a list contains a certain word (the list and the word will be the arguments to the function - your function should return true or false, but should not produce any output). You may use either a loop or a recursive function. You should use the list class from the CS/Math server - it is in the \examples from lecture" folder within the \sample files" folder. Note that the class is actually called my list (since there's a different list class that comes with Metrowerks). 4. Write a function that takes two lists and returns a list of all the words that are contained in both lists. That is, if we give this function the lists ( this list is a test ) and ( another test list ), the function should return either (test list) or (list test). I recommend using a recursive function, but you are not required to do so (there is a recursive solution that's less than 10 lines long). 5. In some of the early labs, you used a cpstring to represent a coloring of a graph that was given in the lab. The graph was given in the question, but we had not (at the time) discussed enough about C++ for you to create a variable representing the graph. You can now create a type to represent each node in the graph, using a cpstring for the name of the node and a list to hold the names of the nodes it is connected to. For example, in the graph from lab 1, the node \NH" is connected to \MA", \VT", and \ME"; the node \ME" is connected only to \NH". Create a class node that is based on this representation, and has a function that tells whether or not two nodes (the parameters to the function) are connected to each other.