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...






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.<br>In this example, Ben is there at row 0 and column 0 in the south and south-east direction, but the<br>code will only output south, as it checks in the order mentioned above.<br>The word search puzzle is<br>BQ I FJQ K YTS D W Q SLG UCX A U BD<br>EEXCA 0B C DEE UOKHG RKJ Q A G P<br>NDNAIKOLULA ANUKAY TURLPI<br>X N J M NETRAILUQ ETUKHB G FEI<br>SYNA AG ULQ J H F CYTSMA SRA H N<br>вСАовсDEEOPYMNQSTUуосоU<br>IGYZHMAWUKNG B YIPUAS H HUI<br>LRBARA AQ F JK X Y Q VNRTYIFR z<br>RIBVJK MPYZ SIFUXCA B Q N PA H<br>CHGN Z XU ZJONATHAN Z WRAMJB<br>TPKLLKGRZERKLNHEZSSW BEz<br>KXLGU U V G W J J S Q KH J Z TI ATH J<br>Q R HO Q G NN Q Z R DUO JY Y BA KDNO<br>A A E CA W US WOCUZMYKU X TEALV<br>GR TNTY MR P BLFDTACSFLLKUD<br>BRALW W N X A E F Q G HK B H X C UPJH<br>Z VANKDHRMOHYO A V ZADSP ZR S<br>IKNBUA O O ZDSM TYHLNZLDWME<br>PESJLFRDSTAX X C MAKHDEGV M<br>DCLEOZWHIKO O AUIJURX ITFO<br>CUGBIO JERAIDAFZIYUSHLJS<br>B N H C C GTBBTNT INTHC X KD DNY<br>AYO ON JA E ZZ OKJ VK G DAFC VRD<br>The word is BEN<br>Word found at row 0 and<br>column 0 in the south direction.<br>

Extracted 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.
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here