Question: Please use C and please add notes to explain what is happening! Thank you! Declare a structure to represent a circle. Each circle stores information

 Please use C and please add notes to explain what is

Please use C and please add notes to explain what is happening! Thank you!

Declare a structure to represent a circle. Each circle stores information about the center and the radius. Center is represented with x and y coordinates. Both center and radius uses doubles. Allocate an array of 50 circle pointers and dynamically allocate memory to store a circle pointed by each array entry. Randomly generate circles using the following function. double rand_floats (double a, double b) {return ((double)rand ()/RAND MAX) * (b-a) +a;} We want all the circles to fit an area of 1000 times 1000. So, x and y coordinates are randomly selected from (100, 900 and radius is randomly selected from (0, 100) using above function. After you insert the random circles, find the circle with the largest area and print the information for this circle. You can use 3.14 for PI and area of a circle is given as PI * radius * radius. Don't forget to free the pointers when you are done with the array. Use valgrind to find any memory leaks. Sample execution is given below Circle with largest area (31380.837301) has center (774.922941, 897.436445) and radius 99.969481

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!