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
Step: 1
Get Instant Access to Expert-Tailored Solutions
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