he twins Kartik and Kunaal want to play word search puzzles with their class. They want to be faster than everyone else in their class, so they decided to write a C code to help them find words with a click of a button. Little did they know, everyone in class decided to do this question.   You are required to implement search2D function.   void search2D(char word[], int wordSize, const int Size, char grid[Size][Size]);   search2D receives the word to look for char word[], the size of the word int wordSize, size of the grid const int Size and the puzzle grid char grid[Size][Size]. The word size can be between 2 and 23. You are NOT required to check for the validity of the word size. search2D should look for the first letter in the word row by row. If it finds the first letter of the word in the puzzle, it should look for the remaining of the word in the 8 directions from the south and goes clockwise, i.e. south, south-west, west, north-west, north, north-east, east and lastly south-east. If the word is found, the function should print the row and column location of the first letter of the word and the direction of the word from that location. Row and column count starts from 0.   These are several tasks in one function; therefore you should implement these two helper functions that search2D will call.   bool search1D(char word[], int wordSize, const int Size, char grid[Size][Size], int row, int col, int rowDir, int colDir);   void printFoundLocation(int rowDir, int colDir);   search1D should receive the word in char word[], word size in int wordSize, size of grid in const int Size and the puzzle grid in char grid[Size][Size], the row and column indices in the grid of the first letter in the word in int row and int col, and the row and column direction to look in int rowDir and int colDir. The function should return if it found the word in this direction or not.   printFoundLocation should receive the direction in int rowDir and int colDir and prints the direction equivalent to these two integers.   You are encouraged to use more functions in your code.   Although you are asked to only implement three functions, you will have to implement the entire program to test your code on VS Code. We suggest you test your code with a small 2D array, example 4 by 4 or 5 by 5 and small words of 2 or 3 letters

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
The twins Kartik and Kunaal want to play word search puzzles with their class. They want to be
faster than everyone else in their class, so they decided to write a C code to help them find words
with a click of a button. Little did they know, everyone in class decided to do this question.
 
You are required to implement search2D function.
 
void search2D(char word[], int wordSize, const int Size, char grid[Size][Size]);
 
search2D receives the word to look for char word[], the size of the word int wordSize, size
of the grid const int Size and the puzzle grid char grid[Size][Size]. The word size can be
between 2 and 23. You are NOT required to check for the validity of the word size.
search2D should look for the first letter in the word row by row. If it finds the first letter of the word
in the puzzle, it should look for the remaining of the word in the 8 directions from the south and goes
clockwise, i.e. south, south-west, west, north-west, north, north-east, east and lastly south-east. If
the word is found, the function should print the row and column location of the first letter of the
word and the direction of the word from that location. Row and column count starts from 0.
 
These are several tasks in one function; therefore you should implement these two helper functions
that search2D will call.
 
bool search1D(char word[], int wordSize, const int Size, char grid[Size][Size],
int row, int col, int rowDir, int colDir);
 
void printFoundLocation(int rowDir, int colDir);
 
search1D should receive the word in char word[], word size in int wordSize, size of grid in
const int Size and the puzzle grid in char grid[Size][Size], the row and column indices in
the grid of the first letter in the word in int row and int col, and the row and column direction
to look in int rowDir and int colDir. The function should return if it found the word in this
direction or not.
 
printFoundLocation should receive the direction in int rowDir and int colDir and prints the
direction equivalent to these two integers.
 
You are encouraged to use more functions in your code.
 
Although you are asked to only implement three functions, you will have to implement the entire
program to test your code on VS Code. We suggest you test your code with a small 2D array,
example 4 by 4 or 5 by 5 and small words of 2 or 3 letters
In the example outputs below, please note that your output is in bold.
In this example, Ben is there at row 0 and column 0 in the south and south-east direction, but the
code will only output south, as it checks in the order mentioned above.
The word search puzzle is
BQ I FJQ K YTS D W Q SLG UCX A U BD
EEXCA 0B C DEE UOKHG RKJ Q A G P
NDNAIKOLULA ANUKAY TURLPI
X N J M NETRAILUQ ETUKHB G FEI
SYNA AG ULQ J H F CYTSMA SRA H N
вСАовсDEEOPYMNQSTUуосоU
IGYZHMAWUKNG B YIPUAS H HUI
LRBARA AQ F JK X Y Q VNRTYIFR z
RIBVJK MPYZ SIFUXCA B Q N PA H
CHGN Z XU ZJONATHAN Z WRAMJB
TPKLLKGRZERKLNHEZSSW BEz
KXLGU U V G W J J S Q KH J Z TI ATH J
Q R HO Q G NN Q Z R DUO JY Y BA KDNO
A A E CA W US WOCUZMYKU X TEALV
GR TNTY MR P BLFDTACSFLLKUD
BRALW W N X A E F Q G HK B H X C UPJH
Z VANKDHRMOHYO A V ZADSP ZR S
IKNBUA O O ZDSM TYHLNZLDWME
PESJLFRDSTAX X C MAKHDEGV M
DCLEOZWHIKO O AUIJURX ITFO
CUGBIO JERAIDAFZIYUSHLJS
B N H C C GTBBTNT INTHC X KD DNY
AYO ON JA E ZZ OKJ VK G DAFC VRD
The word is BEN
Word found at row 0 and
column 0 in the south direction.
Transcribed Image Text:In the example outputs below, please note that your output is in bold. In this example, Ben is there at row 0 and column 0 in the south and south-east direction, but the code will only output south, as it checks in the order mentioned above. The word search puzzle is BQ I FJQ K YTS D W Q SLG UCX A U BD EEXCA 0B C DEE UOKHG RKJ Q A G P NDNAIKOLULA ANUKAY TURLPI X N J M NETRAILUQ ETUKHB G FEI SYNA AG ULQ J H F CYTSMA SRA H N вСАовсDEEOPYMNQSTUуосоU IGYZHMAWUKNG B YIPUAS H HUI LRBARA AQ F JK X Y Q VNRTYIFR z RIBVJK MPYZ SIFUXCA B Q N PA H CHGN Z XU ZJONATHAN Z WRAMJB TPKLLKGRZERKLNHEZSSW BEz KXLGU U V G W J J S Q KH J Z TI ATH J Q R HO Q G NN Q Z R DUO JY Y BA KDNO A A E CA W US WOCUZMYKU X TEALV GR TNTY MR P BLFDTACSFLLKUD BRALW W N X A E F Q G HK B H X C UPJH Z VANKDHRMOHYO A V ZADSP ZR S IKNBUA O O ZDSM TYHLNZLDWME PESJLFRDSTAX X C MAKHDEGV M DCLEOZWHIKO O AUIJURX ITFO CUGBIO JERAIDAFZIYUSHLJS B N H C C GTBBTNT INTHC X KD DNY AYO ON JA E ZZ OKJ VK G DAFC VRD The word is BEN Word found at row 0 and column 0 in the south direction.
Expert Solution
steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Similar questions
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY