Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

Question

initial c++ file/starter code:

#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

// The puzzle will always have exactly 20 columns
const int numCols = 20;

// Searches the entire puzzle, but may use helper functions to implement logic
void searchPuzzle(const char puzzle[][numCols], const string wordBank[],
vector <string> &discovered, int numRows, int numWords);

// Printer function that outputs a vector
void printVector(const vector <string> &v);

// Example of one potential helper function.
// bool searchPuzzleToTheRight(const char puzzle[][numCols], const string &word,
// int rowStart, int colStart)


int main()
{
int numRows, numWords;

// grab the array row dimension and amount of words
cin >> numRows >> numWords;

// declare a 2D array
char puzzle[numRows][numCols];

// TODO: fill the 2D array via input
// read the puzzle in from the input file using cin

// create a 1D array for wods
string wordBank[numWords];

// TODO: fill the wordBank through input using cin


// set up discovery vector
vector <string> discovered;

// Search for Words
searchPuzzle(puzzle, wordBank, discovered, numRows, numWords);

// Sort the results
sort(discovered.begin(), discovered.end());

// Print vector of discovered words
printVector(discovered);

return 0;
}

// TODO: implement searchPuzzle and any helper functions you want
void searchPuzzle(const char puzzle[][numCols], const string wordBank[],
vector <string> &discovered, int numRows, int numWords)
{

}

// TODO: implement printVector
void printVector(const vector <string> &v)
{

}
example input file:

3
2

H E L L O J K L I Y Q S R P Z I M K O P
W R L D Q J K L I Y Q S R P Z I M K O P
B Y Z A N T I N E Q W E R T Y U I O P Z

HELLO
WORLD
star wars file:

25
15
L P O A G Y R K T A T O O I N E D O X L
J G G T J U V R E B A S T H G I L J Y N
F P A X B E L L D N Y U E Z B I E S N H
L E I A H K S U S S A M C V B H N T W S
U I Z U L F F K D O T E J O Z F M D T Z
B M G L G Z E E H R N I N C W X X O T R
I S N T X T K S Z T O E R E H U R D I I
M V P N B W A H L A K I W K X M R C F J
P Z H K L Z J T G T P N D P T P V X Y H
U N W W J Y J R L W U I O R R Y O X P P
G A A I L I B A D V S Y O I U Q H O D F
M O D W Z Z Q D K N Q O N A N F P T H R
D V Z G Y W Z Y Q P P C H G V M T J P P
L Q H V E Z V T G E E M O O F S L G Y L
C Z L U P S A M R S G V X V M I L T F R
U A K B O Z R T S T C Z T P D T A X K A
U A W A V V X I E I D L C Y O O B C N N
S Y I W X C N D V N C H H C D R J A Y A
G J E D I I E Q N S S N G H O I E W I K
G F E G H R J E G L L P Q O Y Q O D E I
A V V N N P D T W R D V C M A G S J A N
A D N I Q Y Y G O W Y E D Y Z A O O P V
R J O K N J M Z L V T U V W H F O F D V
V C T Z H U O B I W A N Z H I P Y B Z M
L M X Y N I T G C Q E L V U Q B P L D L

AMIDALA ANAKIN DARTH
DROID JEDI KENOBI
LEIA LIGHTSABER LUKE
OBIWAN PRINCESS STORMTROOPER
TATOOINE TWILEK VADER
toy story file:

17
38

S T I N K Y P E T E Y O C K D Y N E Y C
B B Y A J S S D R Y M B B H S Q Y R N F
W J S D L J U F P A L O O T U E V R N U
K T B I O C P H Z D O L R P S C E T E E
E I N H K O R F J K H E O L E X K P L R
B K A Y D Z W A W U T S L M B E T L E K
Y Q C D B K Z O E C U U H A E F P T E R
B O Y D N A R U H Y B A R E A S S D H S
T I J A A M E O B N T B I L R U H U T P
Q L G V S I P T P L I H I Y B I B H Q U
E E I B X A B A M E H E G S S Z F D D C
H M I I A I R T H T N T H I G U E F O R
Q D R S X B I O E S L O S A L R A F L E
I T J M S H Y P G Q O C N D B G E O L T
R P N I U E W W R F T N H A M M E Y Y T
E E M I L Y J J A N S H N E K E N K M U
G Y Z E E H W M S A O F H C T I W T P B

ALIENS
ANDY
BARBIE
BIGBABY
BOOKWORM
BOPEEP
BULLSEYE
BUSTER
BUTTERCUP
BUZZ
CHUCKLES
DAISY
DAPHNE
DOLLY
DUCKY
EMILY
GERI
HAMM
JESSIE
KEN
LENNY
LIGHTYEAR
LOTSO
MOLLY
POTATO
REX
RIP
SARGE
SHERIFF
SLINKY
STINKYPETE
STRETCH
TRIXIE
TWITCH
WARDOG
WHEEZY
WOODY
ZURG

c++ code

Assignment Specifications
You will implement a console version of a word search puzzle solver. For this assignment, we are providing an initial source code file which
contains skeleton code that you must complete. You are not allowed to change the provided code. You must use a two-dimensional array
to store the puzzle. Grab the initial C++ file and example input file, then upload all the files to your workspace or place all of the files in the
same folder on your computer if developing locally.
Helpful Hints
• Solve on paper first!
o record the actual steps you take to find a word
• Go through the given code first and note all the TODO comments
• Don't bite off too much, do one TODO at a time, or even break down a TODO into many steps!
• Don't implement everything at once. A search in all 8 potential directions can be confusing, try implementing search in one direction
then move on to another direction.
o If you solved on paper first, hen you should know all
• Print the puzzle and other arrays out to make sure you read it in correctly.
• You should be adding the words to the discovery vector as you find them.
• You only need to find a word once, so it should only exist in the discovery vector a single time.
• Use input redirection to test: ./a.out <mylnputFile.txt
• You do not want to type those entire puzzles in!
• The input file and executable must be in the same directory to use the above input redirection.
words and the direction for each of
disc ered words.
• Don't wait until the last minute, zyBooks will provide a grade and limited feedback so that you can fix your problems and resubmit
prior to the deadline to earn a better grade!
expand button
Transcribed Image Text:Assignment Specifications You will implement a console version of a word search puzzle solver. For this assignment, we are providing an initial source code file which contains skeleton code that you must complete. You are not allowed to change the provided code. You must use a two-dimensional array to store the puzzle. Grab the initial C++ file and example input file, then upload all the files to your workspace or place all of the files in the same folder on your computer if developing locally. Helpful Hints • Solve on paper first! o record the actual steps you take to find a word • Go through the given code first and note all the TODO comments • Don't bite off too much, do one TODO at a time, or even break down a TODO into many steps! • Don't implement everything at once. A search in all 8 potential directions can be confusing, try implementing search in one direction then move on to another direction. o If you solved on paper first, hen you should know all • Print the puzzle and other arrays out to make sure you read it in correctly. • You should be adding the words to the discovery vector as you find them. • You only need to find a word once, so it should only exist in the discovery vector a single time. • Use input redirection to test: ./a.out <mylnputFile.txt • You do not want to type those entire puzzles in! • The input file and executable must be in the same directory to use the above input redirection. words and the direction for each of disc ered words. • Don't wait until the last minute, zyBooks will provide a grade and limited feedback so that you can fix your problems and resubmit prior to the deadline to earn a better grade!
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education