Question: Before we start developing the Boxed l n game, let's design a simple text - version of a box. A box should be rectangular,

Before we start developing the "Boxed ln" game, let's design a simple text-version of a box. A box should be rectangular, and it should have some marking at the exact center position, so that the person pushing the box knows where to push!
For this task, you must define a function called MakeBox() which takes three inputs: a string into which the characters will be stored, the width of the box (an integer), and the height of the box (also an integer). The MakeBox(0) function should generate a string representing the box. A box will simply be represented as a rectangle where the hash character ('#') is used to denote the edges. In addition, the exact center of the box must be denoted using the character ' X '(to help the person push the box in the correct place).
If the width and height of the box are both odd numbers, then there will be a single center position which can be denoted with a single ' X '. If the width and the height are both even numbers, then the center position will have to be denoted with a small square of four ' X ' characters. If only one of the width or height is an odd number, and the other is an even number, then two 'x' characters will be needed to denote the center position. The examples below illustrate these three possibilities:
\table[[\table[[#####],[# #],[# X #],[# #],[#####]],###### # # # XX # # XX # # # ######,##### # # # X # # X # # # #####],[A 55 box (this will have a single center position),A 6x6 box (this will have four center positions),A 6 row, 5 column box (this will have two center positions)]]
Note: the length of the output string will be exactly (width +1)* height characters. This is because there is a single new line character appearing at the end of each line (including the last line).
For Task One, you must define a function called MakeBox0:
void MakeBox (char *design, int width, int height)
You can assume that both width and height will be at least 1. Note, the smallest box size for which you will need to include the center position is 3(if the width or height is 2 or less, it is not possible to include the center position so there will be no ' X ' characters in the string in that case). Need C launguanguage code
Before we start developing the "Boxed l n " game,

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!