Question
Define three structs, point_t, square_t, and circle_t(you may use the point_t and square_t structs from the previous lab). The circle_t struct will contain a center
Define three structs, point_t, square_t, and circle_t(you may use the point_t and square_t structs from the previous lab). The circle_t struct will contain a center point and a radius. Then define a struct called shape_t, which will contain an integervalue indicating whether the shape is a square or circle, and a union containing a square and a circle.Write a function that passes by reference a shape_t variable and returns its area.In main(), prompt the user whether they want to enter a square or a circle. Then input the fields for that shape and print its area.
Task 3: .Define three structs, point t, square_t, and circle_t (you may use the point t and square_t structs from the previous lab). The circle_t struct will contain a center point and a radius. . Then define a struct called shape_t, which will contain an integer value indicating whether the shape is a square or circle, and a union containing a square and a circle. Write a function that passes by reference a shape_t variable and returns its area. In main0. prompt the user whether they want to enter a square or a circle. Then input the fields for that shape and print its areaStep 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