In this lab you will be writing a menu based program that will determin the area of a shape based on user's choice. For each menu option, the program will ask for positive dimensions for the shape, then display the area.
You will also be using two new libraries, cmath for the pow function and iomanip for setprecision in conjunction with iostream fixed. Also #defined constants for your menu options and PI
Use Lab3.cpp as a starting point for this lab, however you may start from scratch if you choose to do so.
You will define 6 constant values: SQUARE as 1, RECTANGLE as 2, TRIANGLE
as 3, CIRCLE as 4, EXIT as 0, and PI as 3.14159
Declare three float variables (base, height, and area) and one int variable
(choice).
Display the menu and prompt for user's choice. Based off user's choice,
branch to the corresponding case. Prompt for dimensions, calculate
the area, and break out of the switch statment. If the user does not
enter a valid menu choice, alert the user that the choice was an
invalid option and exit the program.
Area Formulas:
square: length_of_side2
rectangle: base x height
triangle: 1/2 x base x height
circle: π x radius2
Use the cmath's pow(b,e) function discussed earlier for any exponent
arithmetic. If the dimesions are positive values, display the calculated area
with precision up to 2 decimal places. Otherwise, alert the user that
there was invalid inputed values.
Have your lab check off by me or submit via depository directory
/2010_F18/wk3/lab3.cpp