Help
If for example 3 points are give I have to find the number of points which are inside the circle.I wrote the code but I can't get the right one.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include <iostream>
#include <math.h>
using namespace std;
int main ()
{
float x,y,r,x1,y1,distance;
int n,people,out;
cin >> x >> y >> r;
cin >> n;
for (int cnt=1;cnt<=n;cnt++)
{
cin >> x1 >> y1;
distance=sqrt(((y1-y)*(y1-y))+((x1-x)*(x1-x)));
if (r-distance>=0);
}
cout << " " << people << endl;
return 0;
}
|
`people' is uninitialized
`people' is never modified
Topic archived. No new replies allowed.