Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1 : Setup Write a C program called scrabble, which reads in a list of words and their location on the board, places them
Problem : Setup
Write a C program called scrabble, which reads in a list of words and their location on the board, places
them to the board, and then displays the board.
Input
Your program will read its input from stdin. The remainder of the input consists of several lines:
The first line contains a single integer N denoting the size of the board N
N
The second line contains a second integer W denoting the number of words to place.
This is followed by W lines, each containing the location XY direction D and the word S
X Y D S
where
X is an integer in the range X N denoting the X coordinate of the first letter of the word
Y is an integer in the range Y N denoting the Y coordinate of the first letter of the word
D is either H or V denoting the direction of the word. H for horizontal left to right and V for
vertical top to bottom
S is a single lowercase word which will be one or more letters.
Finally, there is another integer F which for this problem will always be
All words will be in lowercase letters. Hint: Use scanf to read the input See example below.
Processing
The program should use a D array to represent an N
N scrabble and add the words to this board.
To allocate a D array of characters use the declaration:
char boardnn;
in the main function after your program has read in the value for N and stored it in variable n
The topleft corner of the board has coordinate and the bottom right corner is NN
Empty spaces are represented by periods Hint: initialize all board elements to before plac
ing any words.
Horizontal words are placed left to right and vertical words placed top to bottom.
All words will be correctly placed.
Output
All output should be performed to stdout. The output must be exactly as specified. The output should
consist of an N
N block of characters representing a Scrabble board with the word placed on it The top
left corner of the board is location and the bottom right corner is NN All words should be in
lower case
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