CS 1620 Solution # 7 Fall 2000
- DR. Chali's solutions
- headtail.cc -- print the head and tail of a file.
- dictionary.cc -- find a word in a dictionary.
- common.cc -- find the longest common substring in two strings.
- count.cc -- count the number of sentences in a file and the number of words per sentence.
- Rex's solutions
- 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.
- Alternate headtail.cc -- print the head and tail of a file. This one only makes one pass through the file.
- dictionary.cc -- find a word in a dictionary. This one only copies the dictionary as it finds the word.
- Alternate dictionary.cc -- find a word in a dictionary. This one finds the word and then copies the dictionary.
- common.cc -- find the longest common substring in two strings.
- 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.
- 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.
- 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