Question: Write a C++ program that reads a center (in the xy two dimensional coordinate) and a radius, and then determines whether another input point is

Write a C++ program that reads a center (in the xy two dimensional coordinate) and a radius, and then determines whether another input point is located inside the circle or not.

The circle is expressed as (x-a)^2 + (y-b)^2 = c^2, where (a, b) is a center of a circle and c is radius. You can compare the distance between the center and the input point with the

radius. The test outcome will have 4 different results like Inside when the entered point is located inside the circle, Outside when the entered point is located outside the circle,

On the circle when the entered point is located on the circle, Input point error when the entered point is not integer such as characters or symbols.

Your program repeats to ask for checking the location until you enter EOF (ctrl+D or ctrl+Z)

For example,

Enter a center: 0 0 (separate by a space)

Enter a radius: 5

Enter a point to test: 1 1 (separate by a space)

Result: Inside

Enter a point to test: 5 5 (separate by a space)

Result: Outside

Enter a point to test: a b (separate by a space)

Result: Input point error

Enter a point to test: ^D

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!