Question: Use C++: Given the following structure declaration. struct Rectangle { int width int height }; Create an array Rectangles, that has 10 elements. Each element

Use C++:

Given the following structure declaration.

struct Rectangle

{

int width

int height

};

Create an array Rectangles, that has 10 elements. Each element is a Rectangle structure. Assign their width and height in a for loop, setting width equal to the loop counter + 1 and height to the loop counter + 2. Design a function int area (Rectangle *r) that accepts a Rectangle structure reference variable as its parameter and return the area of the rectangle. Use another for loop to display the width, height and area for all elements of the created array.

Output Formatting: include the iomanip header to organize your program output in a table.

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!