CS 170 - Programming Assignment #6

Due Thursday, April 13, 2017 at 10:00 pm


Additional Information

  1. Think. This should be your first action. Before writing a single line of code, make sure you can explain to me or someone else what it is you are trying to do. If you can't write it in English (or your native language), you will not be able to write it in C++.

  2. The WordWrap function is definitely the most difficult for this assignment. Make sure that you document (comment) the function heavily. Any function turned in with just minimal comments will earn 0 points, even if it "works". If I modify the assignment (or put a bug in your code), another student should be able to figure out what's wrong within a few minutes. This function is arguably the most algorithmic function you've had to write in any of my courses so far, meaning, the code is not difficult or long, but intricate.

  3. The dictionaries that you are given are sorted alphabetically. (Go figure.) This means you can stop looking for a word when you encounter one that comes after the word you are looking for.

  4. The dictionaries contain exactly one word per line. All words end with a newline character. Since you're using an ifstream and reading into a string, you don't have to strip off any newlines.

  5. The dictionaries are not guaranteed to be in all lowercase or uppercase. You need to be able to handle both. Do yourself a favor: after you get the code working, make the words in lexicon.txt all UPPERCASE, and see if your program still works. (That's what I'm going to do.)

  6. The only header files you are to include are string, vector, and fstream, and they are already included for you.

  7. Make sure you handle uppercase and lowercase correctly.

  8. DO NOT USE MAGIC NUMBERS. Use the enums and constants that you are given in FileStrings.h (in the SpellChecker class). I will be changing the enumerators when I compile your code. (I'm replacing the header file.) If you used magic numbers instead, you will get an automatic 0 on the assignment for failure to compile (failure to follow instructions).

  9. Hint: For the Tokenize function, there are two methods of a std::string that might be helpful. (find_first_of and find_first_not_of)

  10. You may want to familiarize yourself with the methods in the std::string class, if you haven't already, since you are going to be manipulating std::string objects.
  11. Finally:

    Don't be a fool, use a diff tool™