Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A word search is a game where letters of words are hidden in a grid (2D char array), that usually has a rectangular or square
A word search is a game where letters of words are hidden in a grid (2D char array), that usually has a rectangular or square shape. The objective of this game is to find and mark all the words hidden inside the grid. The words may be hidden horizontally (left-to-right -*), vertically (top- to-bottom or diagonally (left-top-to-right-bottom You are asked to implement a program that perform horizontal, vertical, and diagonal search. The 2D char array can be defined and initialized in the program OR read from a file * If user executes your program with -f filename.txt flag in command line arguments, then dynamically create 2D array and read the characters from the given file. The file will first contains 2 integers to represent the number of Rows and the number of Columns Then it will contain Row*Column many characters as follows: abcd dcba xyzd . If user executes your program without -f filename.txt flag, then use the default 2D array in the program. Here is an example; /* yourprog.c * #de fine Row 3 /* these numbers will be larger */ #de fine COL 4 /* in an actual program */ main () charg[ROW] [COL] = { {'a', 'b','c', 'd'}, 1lha . The words that a user wants to search will be given as command line arguments. User can give as many words as he/she wants. For example
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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