CS010 Week 3 Assignment

Spell Checker

Due: January 23, 2001, 10 AM

This assignment should be turned in for evaluation. To turn in the assignment, you will use the turnin command:

turnin -c 010 assign3.tar

You may turn in the same file more than once. This will overwrite the earlier version. You may want to do this if you discover a mistake or make an improvement after turning in your assignment.

For this assignment, you will write a simple spelling checker. Your spell checker will compare a word input by the user against a list of words (also previously entered by the user). If the word is in the list, it should report that the spelling is correct. If the word is not in the list, it should give a list of possible corrections using the following rules:

If no words in the list match the new word even with these changes, the program should report that the word is misspelled but that it does not have any suggestions. Here is a sample interaction:

-> spellcheck
How many words will be in the dictionary?  6
Dictionary word 1:  elephant
Dictionary word 2:  computer
Dictionary word 3:  basketball
Dictionary word 4:  spaghetti
Dictionary word 5:  alphabet
Dictionary word 6:  commuter

Enter a word to spellcheck (q to quit):  elephant
elephant is spelled correctly.
   
Enter a word to spellcheck (q to quit):  commputer 
commputer is misspelled.  Possible corrections are:
  computer
  commuter
   
Enter a word to spellcheck (q to quit):  absketball
absketball is misspelled.  Possible corrections are:
  basketball
   
Enter a word to spellcheck (q to quit):  spagheti
spagheti is misspelled.  Possible corrections are:
  spaghetti
   
Enter a word to spellcheck (q to quit):  alfabit
alfabit is misspelled.  There are no known corrections.
   
Enter a word to spellcheck (q to quit):  q

Organize your code so that the user interface is in one file and the spell checking functions are in a separate file. Call the user interface file spell_UI.c. Call the spell checker code spell.c. You will also need to provide a spell.h header file and a Makefile to compile and link your code. To turn it in, you should create a tar archive of your file called assign3.tar and submit that.