Homework 8: More Loops
Wednesday, March 28, 2012[Up] [Previous Homework] [Next Homework]
Complete the following:
Solution and with extra credit
- Create a new file called hw08.c
- You are going to create a program that will draw a diamond
- The program will ask the user to input the length of the sides of the diamond
- 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.
- After drawing the diamond, loop back and ask the user again for the size diamond to draw.
- Keep looping until the user enters zero for the size of the diamond to draw
- 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.
- Create a script of you running your program with three different sizes (and three sizes for the extra credit if completed).
- Once you are done, use submit to submit two files, hw08.c and typescript
linux3[1]% submit cs104_sheets hw08 hw08.c typescript