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
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...
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.
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.
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.
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);
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.
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.
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
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
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 5 images
Recommended textbooks for you
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
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 Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
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
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY