Homework 7: More Loops

Wednesday, August 1, 2012     


[Previous Homework] [Next Homework]


Complete the following:

  1. Create a new file called hw08.c
  2. You are going to create a program that will draw a diamond
  3. The program will ask the user to input the length of the sides of the diamond
  4. The program will then draw a diamond figure, with the specified sides, as follow:

    A one sided diamond:
    
     *
    
    A two sided diamond:
    
      *
     ***
      *
    
     A three sided diamond
    
       *
      ***
     *****
      ***
       *
    
    etc.
    

  5. After drawing the diamond, loop back and ask the user again for the size diamond to draw.
  6. Keep looping until the user enters zero for the size of the diamond to draw
  7. EXTRA CREDIT: Ask the user an additional question about whether to draw a diamond or a box, if they choose box, then only draw the outside edges of the diamond shape.
  8. Create a script of you running your program with three different sizes (and three sizes for the extra credit if completed).
  9. Once you are done, use submit to submit two files, hw08.c and typescript

    linux3[1]% submit cs104 hw07 hw07.c typescript