c visual studio
Printing Shapes
Create a program that:
- Prompt the user to choose between a rectangle and a triangle
- Prompt user for shape parameters
-
- Rectangle
- Ask user to choose between supplying a word or a width
- Ask user for height
- Triangle
- Ask user to choose between supplying a word or a width, and whether the triangle points up or down
- Read input
- Rectangle
- Print the desired shape
- If the user chooses to draw a rectangle with a word, print it to a file named “shape.txt” in addition to
- Ask the user if they would like to exit, or return to step 1
Points:
2 – Documentation, readability, format
3 – Proper program flow (conditionals, loops, etc)
1 – File output
2 – Filename and Header
2 – Output testing
Header
//<Your Name>
//CPSC 120 Lab 4
//<MM/DD/YY>
Filename
<Last Name><First Initial>lab4.cpp
//DrawRectangle(5,3)
*****
*****
*****
//DrawRectangle(“VOTE”, 3)
shape.txt:
VOTE
VOTE
VOTE
//DrawTriangle(4, true)
*
**
***
****
//DrawTriangle(“VOTE”, false)
VOTE
OTE
TE
E
//DrawTriangle(“VOTE”, true)
E
TE
OTE
VOTE