Introduction to Computer Science:
Assignment 38:  Words.txt and vectors of strings
 Sewickley Academy, 2000-2001

See Course Home Page.
 
Date Assigned: Fri Feb-9
Date Due: Thu Feb-15

0.  If you are so inclined, see the extra credit section below.

1.  Study for the quiz on Monday covering the questions and answers in the Hints to Assignment 37.

2.  Write a program which reads in a list of words (perhaps a lot of words) where the end of the list is indicated by the word "_end_" (which is not part of the list -- it just marks the end), stores them in a vector, sorts that vector, and then prints out the following information:

a.  How many words are there?
b.  What word has the most vowels?  Hint:  Write a method, bool isVowel(char c), which returns true iff c is a vowel.
c.  What word has the most consecutive vowels?
d.  What is the longest word?  Hint:  This is easy once the list is sorted.
e.  What is the average word length?
f.  What is the median word length?  Hint:  This is also easy once the list is sorted.
3.  Test your program over the 69,000+ words in words.txt.  To run your program using words.txt as input, you can do the following:
a)  Go to Project/Settings/Link and set your output file name to "c:\temp\asst38.exe"
b)  Save words.txt to c:\temp\words.txt
c)  Compile your program
d)  Run a DOS Command Prompt (available via the Start button)
e)  In the DOS window, type:  "cd c:\temp"
f)  Next, in the DOS window, type:  asst38.exe < words.txt
4.  For extra credit, you may answer the following:
f)  What word would receive the top Scrabble score, and what would that score be? (Do not count the 50-point bonus for clearing your rack, nor consider bonus squares on the board -- just use the point values for the letters in each word.)
 

g)  Print out a table of each of the 26 letters and their frequencies as a percentage of the overall letters in all the words.
 

h)  What word has the most consecutive consonants?
 

i)   What is the most common 2-letter substring in all words?  3-letter?  4-letter?

5.  For a major challenge, and buckets of extra credit, you may attempt the following:
j)  Using these words as your dictionary, write a decent spellchecker.

k) Read in words and generate all the anagrams of those words in this list.
 

l)  Read in word1 and word2, and generate a sequence of words which begins with word1 and ends with word2 where each word is in the dictionary and each word differs from the word before it by only one letter.  (So, on input "dog", "fen", your program might output:  dog --> don --> den --> fen).  More extra credit if you can guarantee there are no shorter possible sequences.

Good luck!

DK


Extra credit to whosoever shall submit the most compelling short story, poem, or essay including the most possible words from: http://www.worldwidewords.org/weirdwords/index.htm

Note that gratuitous uses will not count, as in: "Anyone who does not know what 'bloviate' means is an idiot."

That's bloviation (used non-gratuitously here, thank you very much), and does not count.  :-)

Sans caltrop,

DK


See Course Home Page.