CS 1620 Solution # 7 Fall 2000


  1. DR. Chali's solutions
    1. headtail.cc -- print the head and tail of a file.
    2. dictionary.cc -- find a word in a dictionary.
    3. common.cc -- find the longest common substring in two strings.
    4. count.cc -- count the number of sentences in a file and the number of words per sentence.

  2. Rex's solutions
    1. headtail.cc -- print the head and tail of a file. This one makes one pass to count the number of lines and then a second pass to print the head and tail.
    2. Alternate headtail.cc -- print the head and tail of a file. This one only makes one pass through the file.
    3. dictionary.cc -- find a word in a dictionary. This one only copies the dictionary as it finds the word.
    4. Alternate dictionary.cc -- find a word in a dictionary. This one finds the word and then copies the dictionary.
    5. common.cc -- find the longest common substring in two strings.
    6. count.cc -- count the number of sentences in a file and the number of words per sentence. This one processes the file one character at a time.
    7. Alternate count.cc -- count the number of sentences in a file and the number of words per sentence. This one processes the file a whole line at a time using the string functions.
    8. Alternate count.cc -- count the number of sentences in a file and the number of words per sentence. This one processes the file a word at a time.

Solution List | Prev | Next | Computer Science 1620
Department of Mathematics & Computer Science
University of Lethbridge Home Page