Homework 7 - UMBC-CMSC104/General GitHub Wiki

The assignment

Please name this homework shapes.c.

For this assignment, I want you to write a program that gives the user the option of drawing two shapes: a right angle triangle and a square. They will be drawn using the * character.

Welcome to homework 7!
Would you like a triangle or a square?
1) Triangle
2) Square
Please enter a selection: 

If the user selects a triangle, prompt the user for the height and draw it:

Welcome to homework 7!
Would you like a triangle or a square?
1) Triangle
2) Square
Please enter a selection: 1
What is the height of this triangle? 5

*
**
***
****
*****

If the user selects a square, prompt the user for the side length and draw it:

Welcome to homework 7!
Would you like a triangle or a square?
1) Triangle
2) Square
Please enter a selection: 1
What is the height of this triangle? 5

*****
*****
*****
*****
*****

Note: Make sure the sides of the square are equal.

To submit, type:

submit cs104_wilson hw07 shapes.c

Extra credit opportunity

To get some extra credit, make some more shapes:

Isosceles triangle (example with height 5):

    *
   ***
  *****
 *******
*********

Hollow square (example with side length 5):

*****
*   *
*   *
*   *
*****