CS 200 - Assignment 2

Due: Thursday, September 27th by 11:59 PM

Barn door program

Write a program to print a "barn door" using text characters.  The program should prompt the user for an integer size, and print a "barn door" figure of the requested size.

Here is an example run (user input in bold red):

How large? 11
+-----------+
|\ /|
| \ / |
| \ / |
| \ / |
| \ / |
| X |
| / \ |
| / \ |
| / \ |
| / \ |
|/ \|
+-----------+

Notice that there are 11 '-' characters in the first and last row of the figure.

Getting Started

Download CS200_Assign2.zip.

If you have the Marmoset Add-in installed, you can import the zip file using File->Import....

If you do not have the Marmoset Add-in installed, create a new folder, extract the contents of the zip file into the folder, navigate into the folder using a file browser, and then double-click the solution file (CS200_Assign2.sln).

If you are using Linux or Mac OS X, extract the zip file into a new folder.  In a terminal window, use the make command to compile the program and the ./BarnDoor command to execute the program.

Hints

You can print out a single backslash character as follows:

printf("\\");

Your program will need to use loops.

Submitting

If you have the Marmoset Add-in installed, you can submit online automatically by using the Tools->Submit... menu item.  Just type in your Marmoset username and password and click Submit.  After a few seconds, you should see a dialog box informing you whether or not the submission was uploaded successfully.  If successful, the dialog will look like this:


If you do not have the Marmoset Add-in installed, or if the automatic online submission does not work, create a zip file containing your entire project and manually upload it to the Marmoset server.  (See the submission instructions for details.)