Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a Ct program that calculates and displays the area and perimeter of three kinds of shapes: CIRCLE, SQUARE, and RECTANGLE. Follow the following steps
Write a Ct program that calculates and displays the area and perimeter of three kinds of shapes: CIRCLE, SQUARE, and RECTANGLE. Follow the following steps 1 Define a scoped enumeration named ShapeKind whose possible values are the above three shape kinds. Define a Shape structure with three members: 2. An enumerated variable named kind whose data type is the scoped enumeration Shapekind defined in step 1 Two double members named length and width representing the length and width of the square or rectangle shapes. For circles, the length and width are the same and you can use the length as the diameter of the circle.. o o Define a function with the following prototype the shape 3. for calculating and returning the area of double area (Shape s) Define a function with the following prototype for calculating and returning the peri 4. meter of the shape double perimeter (Shape s) Define a function with the following prototype for returning the string "Circle", "Rectangle", or "Square" depending on the kind of the shape 5. string kind (Shape s)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started