15,850,299 members
See more:
```Problem-2: Point and a circle
Write a program that prompts the user to enter a point (x, y) and checks whether the
point is: 1-on the outer edge of the circle, 2- outside the circle, 3- inside the circle
centered at (xcenter, ycenter) with radius r.
A point is on the outer edge of the circle if the distance between (x, y) and (xcenter,
ycenter) is equal to the radius r. Note that double and float comparisons can be tricky, so
allow for an error margin of 0.01, such that when the difference between distance and
the radius is less than 0.01, they are considered equal.
A point is outside of the circle if the distance separating it from the center is greater
A point is inside of the circle if the distance separating it from the center is less than

What I have tried:

```A point is outside of the circle if the distance separating it from the center is greater
A point is inside of the circle if the distance separating it from the center is less than
Posted
Updated 3-May-21 1:00am
Rick York 3-May-21 13:50pm
Here's one tip : the error margin is sometimes referred to as epsilon and it can be positive or negative so you can use the fabs function to get the absolute value of the floating point difference. That will let you do a single comparison operation with the allowed error margin of 0.01.

## Solution 2

Once you write a the `distance` function, the rest of the code is very simple.
If you don't already know the distance formula, then you may find it, for instance, here: Distance Between 2 Points[^].

## Solution 1

We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]

## Solution 3

1. the input of information with asking the user.
2. Than compute the result with some distance function and
3. put it out.

Use some functions and classes with good names to demonstrate your knowledge like writing a point class which has a distance function which takes a point as input.

Visit some Learn C++ tutorial to learn the basics.