Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a c program for word search of file must use the given function. We will implement a word search game for this problem. The
Write a c program for word search of file must use the given function.
We will implement a word search game for this problem. The file DataFile.txt contains a word search puzzle that is size 201 x 100 (2011ines and each line has 100 characters -all characters are uppercase This puzzle is made simple in that all words arehidden horizontally, and in forward order i.e. no words are written backwards, nor vertically nor diagonally Although the words areall hiddenin forward order, they may occur multiple times on any given line (see sample code execution Since there areno lowercase characters in the puzzle, you should not worry about converting lowercase to uppercase or vice versa. A sample portion of the puzzle is HRAHYIRLLGWLZAUAQLLCUNELECTRICALGFMFUXILERWZYDDZUERLYLWKILGIUJLENCNSDXFOYAXMPAEBZBDEZGYZNIVTBR]Z which is difficult enough to search asit is The words that are hidden in the puzzleare: PROGRAMMING, FPRINTF, FSCANF, DOUBLE MAIN, DOWHILE, F GETS, INT, DF, WHILE, ENGINEERING, RETURN, CHAR,FCLOSE ELECTRICAL, ECE, VOID, FLOAT, FOR Write a C program that will search the text file for the word entered by a user. Your program should a read from the text file one line at a time Hint: use fgets b pnnt to the screen bl the word that is currently being searched b2) number of times the word was found on the line b3) the line number and the line where the word was found b4) how many times in total the word was found in the puzzle or the wordis not found c) be interactive such that it asks a user whether he/she wants to search the puzzle with a new word See sample code execution. d) use the following given user-defined function int search current line (char Line str char word This function searches a test string Line str for a word land returns number of times the word is found on Line str A command that you might find useful is Assuming that f is declared as FILE *fp you can rewind the file pointer back to the beginning of the file using rewind(fp)
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