Question
Write a program that uses an array of structures, where each structure contains a shape name, and shape type (rectangle or square). If the shape
Write a program that uses an array of structures, where each structure contains a shape name, and shape type (rectangle or square). If the shape is a rectangle, then the structure should contain the length and width of the shape. If the shape is a square then the structure should contain the length of the side of the shape. The program should first allow the user to enter the name of a shape, the type of the shape and the data concerning the type of the shape (length and width, or length of the side) for n shapes to be stored in the array (n is input by the user). The array should contain a maximum of 10 cells. After all input has been read, allow the user to enter a name then print the shape using stars on the screen along with the size of the area. The user should be able to print as many shapes as he/she wishes until they choose to stop.
EXAMPLE Below:
(in C programming language)
Width Side Name Length Shapel Shape2 Shape3 Shape4 rectangle square rectangle square If Shape3 was chosen to be printed, then the following output would appear area 15 r Shape e pu would appeari t*tt area 36Step 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