Design Suggestions

If you need some help getting started with this assignment, perhaps the following ideas will help:

Write a function

void MakeVertPieces(int width)

that inputs a width and writes the necessary sequence of vertical lines. For example the call

MakeVertPieces(3) ;

writes this out:


|   |   |   |
|   |   |   |


This is the right number of vertical lines for a floor that is three tiles wide.

Also, write a function

void MakeHorizLine(int width)

that inputs a width and writes the necessary section of dashed lines for a floor of the indicated width. For example the call

MakeHorizLine(3) ;

writes out this dashed line:


-------------


Now, just as one example, note that the sequence of calls:

MakeHorizLine(3) ;
MakeVertPieces(3) ;
MakeHorizLine(3) ;


writes out one row of tiles 3 tiles wide:


-------------
|   |   |   |
|   |   |   |
-------------


Each of the functions described above should use a loop to write out the correct amount of output, based on the value of the parameter -- the width.

Your program needs to be able to repeatedly write rows of tiles like the one above, according to the length input by the user. For that, you will need to write another loop in your program that calls MakeHorizLine(width) and MakeVertPieces(width) enough times and in the correct order.

WATCH OUT FOR FENCE POSTS

There are fence post problems to solve when you write MakeHorizLine and MakeVertPieces.

Also another fence post problem comes up when you write the loop that outputs the floor. For example, it takes three calls to MakeHorizLine and two calls to MakeVertPieces to make a floor with two horizontal rows of tiles.