Starting from:

$25

CPSC121-Lab 3 Printing Shapes Solved

Create a program that:

1.     Prompt the user to choose between a rectangle and a triangle

2.     Prompt user for shape parameters

a.     Rectangle

i.            Ask user to choose between supplying a word or a width

ii.          Ask user for height

b.     Triangle

i.            Ask user to choose between supplying a word or a width

ii.          Ask whether the triangle points up or down

3.     Print the desired shape

a.     Ask the user whether they want to print to a file, “myshape.txt”, or to cout

i.            This can be accomplished using fewer lines of code by using the base ostream type as an argument, which ofstream and cout are both derived from. See here

4.     Ask the user if they would like to exit, or return to step 1

You must use at least two functions in this lab. How involved you get with them (including arguments, creating helper functions) is left up to you

More products