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:

Write a program that uses an array of structures, where each structure

(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 36

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!