CS 16, Summer 2012
Programming Project 2

For this assignment you must must turn in individual work. It is okay to work with another student to plan your solution, but your source code must be entirely your own creation.

Due: Friday, August 10, 11:59pm
Worth: 5% of final grade

  1. Write a C program to print diamond shapes composed of '*' characters like this example, and as further specified below.
    Here the user asks for a diamond of size 5, and then no more diamonds (user input is boldface).
    -bash-4.2$ ./diamond
    enter ODD size > 0: 5
    more? n
  2. Compile the program and thoroughly test it at CSIL. Make sure the version that you turn in will successfully compile and execute, so we will be able to test it too. Remember that partial credit will be awarded for partial solutions - but only if we can test your solution. That means you should only turn in working code, and remove (or completely "comment out") any failed attempts to solve the more advanced problems. If we cannot compile and test your program, then we cannot award more than minimal credit for your efforts.
  3. Go to CSIL (in person unless you can manage this step remotely without any assistance from us). Open a terminal window, cd to the same directory as your source code file, then type the following:
    turnin p2@cs16 diamond.c

Optional Challenges

Do not change diamond.c to accomplish these challenges. Write new programs instead. Do not turn in these challenges - they are just for you to practice and learn. By the way, this part doesn't count, and so it is okay to work with a partner on it.

Adapted by Kyle Dewey from C. Michael Costanzo