Introduction to Computer Science:
Assignment 35:  Simple Spellchecker
 Sewickley Academy, 2000-2001

See Course Home Page.
 
Date Assigned: Thu Feb-1
Date Due: Fri Feb-2

Your task tonight is to write a very simple spellchecker, as this is a fine example of using vectors of apstrings, just like we did in class today.  First, read in words (just like we did in class today!) until you read in the word "done".  Store all these words in a vector of apstrings called dictionary (hmmm, wonder what these words are?).  These words constitute your dictionary, oddly enough.

Next, read in another set of words.  Keep reading until you read in the word "done".  For each word you read in, if it is in the dictionary, do nothing.  Otherwise, output the word, followed by a colon, followed by a comma-separated list of nearby words in the dictionary, followed by a new line, as such:
    pont:  pant, pint, punt, font, wont, port, post, pond

What is a nearby word?  It is a word which has the same number of letters, but which differs from the misspelled word by exactly one letter.   Look at the examples above.

Hint:  remember to divide-and-conquer!

Hint 2:  This does not require too much code.  If you find yourself writing volumes of code, start again, and use top-down, structured programming techniques (that is, divide-and-conquer).

Good luck!

DK


See Course Home Page.