Write a c++ program that reads the x,y coordinates
write a c++ program that reads the x,y coordinates of a point. Then you program should determine wither this point lies inside a circle with radius equal 5 and centered at the point (1,2) or not.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Hemant SrivastavaRank #581 · 4.2K reputationPosted Mar 6, 2013, 6:01 AM EST
#include
#include
#include
using namespace std;
int main ()
{
int PointX = 3;
int PointY = 5;
bool result = IsPointWithinCircle(1,2,5, PointX, PointY)
if(result == true)
cout<<"Point is within";
else
cout<<"Point is outside";
return 0;
}
public bool IsPointWithinCircle(int CenterX, int CenterY, int radius, int PointX, int PointY)
{
bool IsPointWithin = false;
float dist = sqrt( (CenterX - PointX)* (CenterX - PointX) + (CenterY - PointY)* (CenterY - PointY));
if (dist > radius)
{
IsPointWithin = true;
}
return IsPointWithin;
}
VulpesRank #55 · 29.2K reputationPosted Mar 6, 2013, 6:04 AM EST