In C programming... Problem 1 You are to write a C program that will input up to 100 circles assuming there are no duplicates. It
In C programming...
Problem 1 You are to write a C program that will input up to 100 circles assuming there are no duplicates. It is to compute the area of each circle and is to sort the circles by the following criteria for comparing two circTles: a) the circle with the smaller area is to come first in the sorted list b) a tie under (a) is resolved by the distance from the centre of the circle to the origin the one with the smaller distance comes first in the sorted list c) a tie under (b) is resolved by comparing the x coordinate for the circle centres the one with the smaller value comes first d) a tie under (b c ) is resolved by comparing the y coordinate for the circle centres the one with the smaller value comes first Note there cannot be a tie under (d) as the two circles would be the same. NOTE: Your program is to actually sort the circles and not just print them in the specified order. You are to use the qsort function provided in . Input: The circles will be entered one per line as three doubles. For example 2.3 4.5 6.2 is a circle centred at x=2.3 and y=4.5 with radius 6.2. The end of input is indicated by a line with a nonnumeric e.g. stop or end. There will be no more than 100 circles input and you can assume there are no duplicates and no errors in the input Output: The sorted list of circles is to be displayed with one circle per line. Each circle is to be displayed in the following format illustrated for the example circle above: c = (2.3000,4.5000) r = 6.2000 a = 120.7628
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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