HI,I am new to C＋＋programming.I would be grateful that if someone can give me some hints about my problem.Because I have no idea about how to write this program.

Here is what I want to write.
First the user input the center(x1,y1) and radius(r) of the circle
Then, I want my program to find a coordinate(x2,y2) for the user.

Restrictions for(x2,y2):
The coordinate should be as close as possible to the circle
The coordinate can be a point of the circle
Both the x,y coordinate should be prime numbers

My plan is to find all prime number coordinate within a (2r+1)(2r+1)square and the center of the square will be (x1,y1).Then calculate the distance(D) between the prime number coordinates within the square and the center.
Finally find the coordinate with the smallest D to obtain the ans.
Coordinates with D<r will not be considered.

But the problem I encountered is I know how to find prime numbers in one dimension by C++,but I do not know how to find prime number in two dimensions by C++.

Can someone give me some suggestions. It will be great if u can share other ways to find the coordinate. Thanks!

 Both the x,y coordinate should be prime numbers But the problem I encountered is I know how to find prime numbers in one dimension by C++,but I do not know how to find prime number in two dimensions by C++.

x2 must be prime. x2 is a scalar, "one dimensional" number. There is no "2D" in finding x2.
y2 must be prime. y2 is a scalar, "one dimensional" number. There is no "2D" in finding y2.
Do you consider -3 to be prime?
If not, can x1 or x2 be negative?
What if r is significantly less than 1?
Topic archived. No new replies allowed.