Question
You will be reading in a word puzzle and a list of words. You will look for the words within the puzzle. The words can
You will be reading in a word puzzle and a list of words. You will look for the words within the puzzle. The words can be found in one of eight possible directions horizontally, vertically or diagonally. Your program must have at least 3 functions in addition to the main function.
Here is a sample run using input files puzzle1.txt and words1.txt. These input file names are read in from cin by main. The message "The puzzle from file …" is also output by main. The actual puzzle contents are output by displayPuzzle.
The puzzle from file "puzzle1.txt"
JSOLUTIS
SUNARUUA
NEPTUNET
SONIEISU
RCEVTRER
AHTRAESN
MMERCURY
The word EARTH was found at (6, 6) - left
The word JUPITER was found at (1, 1) - right/down
The word MARS was found at (7, 1) - up
The word MERCURY was found at (7, 2) - right
The word NEPTUNE was found at (3, 1) - right
The word SATURN was found at (1, 8) - down
The word URANUS was found at (2, 6) - left
The word VENUS was found at (5, 4) - right/up
The word PLUTO was not found
If a word is found more than once the message should be:
The word NUS was found 2 times
Where the number 2 is replaced with the actual number of times the word was found.
Note that all of this text is either output by main or by displayPuzzle. You can delegate this work to other functions, if desired, but your read Puzzle and find Word functions must not write out any message to cout.
Do this project in C++ .
Step by Step Solution
3.40 Rating (166 Votes )
There are 3 Steps involved in it
Step: 1
C programs to search a word in a 2D grid include usingamespacestd For searching in all 8 direction i...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started