Question
puzzle1.txt W D B M J Q D B C J N Q P T I I R Z U X U Z E A
puzzle1.txt
W D B M J Q D B C J N Q P T I I R Z U X U Z E A O I O R T N M N Z P L R N H L Y L X H M D M Y E K A I D P I U L Y O W I A O A B A R K U F V I H L A A L O N M R X K I O J N A V R N A E P T A A R A R T O W A I A S U C Z A U S I N A I A L Z V K O T A O N R K I S S I A O N A H X S V K A I A E A I B N E U D S X N X C C D W G S A A V O I S D W L E J N J T X M H A M O X W T N H Q D X O Q A Q D R U U V G E O R G I A Q V D A V F L O R I D A L G L W O X N
Words you will be searching for:
states.txt
Alabama Alaska Arizona Arkansas California Colorado Connecticut Delaware Florida Georgia Hawaii Idaho Illinois Indiana Iowa Kansas Kentucky Louisiana Maine Maryland Massachusetts Michigan Minnesota Mississippi Missouri Montana Nebraska Nevada NewHampshire NewJersey NewMexico NewYork NorthCarolina NorthDakota Ohio Oklahoma Oregon Pennsylvania RhodeIsland SouthCarolina SouthDakota Tennessee Texas Utah Vermont Virginia Washington WestVirginia Wisconsin Wyoming
given code:
wordsearch.c
#include
// Declarations of the two functions you will implement // Feel free to declare any helper functions void printPuzzle(char** arr, int n); void searchPuzzle(char** arr, int n, char** list, int listSize);
// Main function, DO NOT MODIFY!!! int main(int argc, char **argv) { int bSize = 15; if (argc != 2) { fprintf(stderr, "Usage: %s
// Open file for reading puzzle fptr = fopen(argv[1], "r"); if (fptr == NULL) { printf("Cannot Open Puzzle File! "); return 0; }
// Read puzzle block into 2D arrays for(i=0; i fscanf(fptr, "%c %c %c %c %c %c %c %c %c %c %c %c %c %c %c ", *(block+i), *(block+i)+1, *(block+i)+2, *(block+i)+3, *(block+i)+4, *(block+i)+5, *(block+i)+6, *(block+i)+7, *(block+i)+8, *(block+i)+9, *(block+i)+10, *(block+i)+11, *(block+i)+12, *(block+i)+13, *(block+i)+14 ); } fclose(fptr); // Open file for reading word list fptr = fopen("states.txt", "r"); if (fptr == NULL) { printf("Cannot Open Words File! "); return 0; } // Save words into arrays for(i=0; i // Call searchPuzzle to find all words in the puzzle searchPuzzle(block, bSize, words, 50); printf(" "); // Print out final puzzle grid with found words in lower case printf("Printing puzzle after search: "); printPuzzle(block, bSize); printf(" "); return 0; } void printPuzzle(char** arr, int n){ // This function will print out the complete puzzle grid (arr). It must produce the output in the SAME format as the samples in the instructions. // Your implementation here } void searchPuzzle(char** arr, int n, char** list, int listSize){ // This function checks if arr contains words from list. If a word appears in arr, it will print out that word and then convert that word entry in arr into lower case. // Your implementation here }
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