Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4) Crossword Puzzle Reader. Write a program that finds the strings in the following hard-coded crossword puzzle character array named crossword[20][20], and copies these strings

4) Crossword Puzzle Reader. Write a program that finds the strings in the following hard-coded crossword puzzle character array named crossword[20][20], and copies these strings to another array of strings named words[18][11]. Then use a nested loop to print the crossword puzzle itself. Then use words[18][11]and a loop to print a list of all 18 words in the puzzle. Output: Hello! You were expecting the answer here? Please print the puzzle itself in puzzle format. Followed by each word in the puzzle, formatted as a list. Thanks, Prof Ross Use the following code/psuedocode: char crossword[20][20] = { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', ' ',' ',' ',' ',' ','G',' ','R',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', ' ','P','R','O','V','O','L','O','N','E',' ',' ',' ',' ',' ',' ',' ','C',' ',' ', ' ',' ',' ',' ',' ','U',' ','M',' ',' ',' ',' ',' ',' ',' ',' ',' ','A',' ',' ', ' ','S',' ',' ',' ','D',' ','A',' ',' ',' ',' ','B',' ',' ','F',' ','M',' ',' ', ' ','W',' ',' ',' ','A',' ','N',' ',' ',' ','G','R','U','Y','E','R','E',' ',' ', ' ','I',' ',' ',' ',' ',' ','O',' ',' ',' ',' ','I',' ',' ','T',' ','M',' ',' ', ' ','S',' ','M',' ',' ',' ',' ',' ',' ',' ',' ','E',' ',' ','A',' ','B',' ',' ', ' ','S',' ','U',' ',' ',' ',' ',' ',' ','C',' ',' ',' ',' ',' ',' ','E',' ',' ', ' ',' ',' ','E',' ',' ','M',' ',' ',' ','A',' ',' ',' ',' ','R',' ','R',' ',' ', ' ',' ',' ','N',' ',' ','O',' ',' ',' ','M',' ','R','I','C','O','T','T','A',' ', ' ',' ',' ','S',' ',' ','Z',' ',' ',' ','E',' ',' ',' ',' ','Q',' ',' ',' ',' ', ' ',' ',' ','T',' ',' ','Z',' ',' ',' ','M',' ',' ',' ',' ','U',' ',' ',' ',' ', ' ','C','H','E','D','D','A','R',' ',' ','B',' ',' ',' ',' ','E',' ',' ',' ',' ', ' ',' ',' ','R',' ',' ','R',' ',' ',' ','E',' ','G',' ',' ','F',' ','J',' ',' ', ' ',' ',' ',' ',' ',' ','E',' ','G','O','R','G','O','N','Z','O','L','A',' ',' ', ' ',' ',' ',' ',' ',' ','L',' ',' ',' ','T',' ','U',' ',' ','R',' ','C',' ',' ', ' ',' ',' ',' ',' ',' ','L',' ',' ',' ',' ',' ','D',' ',' ','T',' ','K',' ',' ', ' ',' ',' ',' ',' ','P','A','R','M','I','G','I','A','N',' ',' ',' ',' ',' ',' ', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ' }; char words[18][11]; /* Here is an algorithm to find words in puzzle array and copy them to words array. Look at every char in puzzle. If it is not a space, then check if it is the start of a word. Verticle words have spaces left, right, and above. Horizontal words have spaces top, bottom, and left. Every word ends with a space. */ // look at every char in puzzle for each row { for each col { Page 4 of 6 // is crossword[row][col] not a space? { // is it the start of a vert word? // space above && space left && space right { // copy it to words for each j until crossword[row+j][col] is a space) { // copy each char to wordrow, (vertically) words[wordrow][j] = crossword[row+j][col]; } words[wordrow][j] = 0; // insert null terminator //increment word row index } // is it the start of a horz word? // if(space above && space left && space below) { // copy it to words for each j until crossword[row][col+j] is a space { // copy each char to wordrow, (horizontally) words[wordrow][j] = crossword[row][col+j]; } words[wordrow][j] = 0; // insert null terminator // increment word row index } } // end if not space code block } // end col loop } // end row loop // print words array // another loop here, cycle thru words[j]

**USE #include

studio.h

string.h

ctype.h

stdlib.h

time.h *************

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Usability

Authors: Jakob Nielsen, Raluca Budiu

1st Edition

0133122131, 9780133122138

More Books

Students also viewed these Programming questions

Question

2. What are your biggest concerns about giving a speech in public?

Answered: 1 week ago