Computer Programming I
Lab Project #8 - Spellchecker
THE PROBLEM: Design and write a program in C++ that
will read in at least 100 correctly spelled words from a file called “proof.txt”.
These words will be stored in an array of strings.
The program
will then prompt the user for a sentence.
This sentence must be read in as a single string. The string should be broken up into words,
and each word should be checked against all the words in the “proof.txt” file. Each word that it doesn’t know it should
display as an error.
Example:
Reading
file “Proof.txt” . . .
Enter
a Sentence to Spell-Check:
>Hello
there comptuer
Error! Word: “Comptuer” is misspelled.
THE DESIGN: Recall the steps in problem-solving, go through each one in this project. Your top-down design, written on a computer, should be written at the top of your program as comments. The design must be complete, with each step of the algorithm matching the actions of your program. Your design will be compared to your program.
IMPLEMENTATION: In your program you must write a class
to handle the array of words. There
should be several member functions in this class. You must handle both upper and lower case letters.
WHAT TO HAND IN: You must hand in your design as
comments at the top of your program and as comments for each function, your
program and your sample test runs on paper.
EXTRA CREDIT: 5 pts of extra credit are yours on this project if your program sorts the words it reads from the “proof.txt” file. 5 more pts are possible if you make the program use a binary search on the array of words instead of a linear search.