Please read the remarks about programming problems for this course.
In this assignment you will augment your code from Part 1 to solve a word search puzzle.
Copy all of your C++ files from the previous assignment into a new directory (folder or project). As before, this program will consist of the four C++ files wspuzzle.cpp, wordsearch.h, wordsearch.cpp, and uniformrandom.h.
You should add one function declaration to wordsearch.h:
You can use your code from before to create a puzzle and key and
then check your new solve
function with the puzzle to
see if it matches the key.
Even if you did not successfully complete
Part 1, you still can complete this assignment. Recall that
that in LetterMatrix.h
operator>>
is overloaded for the
LetterMatrix
type. This allows you to easily load a
puzzle or a key from a file; for example,
solve
function:
solve
function.
solve
function
to the key you previously read from the file.
You can use the operator==
operator (also
overloaded for LetterMatrix
) to check your
generated key and the actual key for equality.
While very unlikely, it is possible for your generated key to
differ from the solution that your solve
function
returns. This
especially is true if the hidden words are short. (It is possible
that the randomly filled letters coincidentally make up a word in
the word list.) That is acceptable; you will just have to check
such a solution by hand.
Submit your completed wordsearch.cpp C++ source file to http://eclass.e.southern.edu. Be sure your name appears within a comment as the first line in each source file you submit.