Hi every I'm new here and new to programming. : )

Here is a practice assignment I have completed but seemingly not correctly. Can anyone offer advice as to my error? It compiles correctly but using some test numbers I only ever recieve that the circle has no x intercepts

*Text Problem*

The standard form of an equation for a circle is (x − h)^2 + (y − k)^2 = r^X2 where (h,k) represents the center of the circle and r is the radius. The y-value of the equation becomes zero at the point of intersection with the x-axis. When the value of 0 is substituted for y, the equation can be simplified to a quadratic equation in standard form. From here, the value(s) of x can be resolved using the quadratic formula. Write a function that accepts the center point and radius of a circle and returns how many times the circle crosses the x-axis, if at all. If an intersection occurs, the function should return the x-value(s) as well. This new function should call the a quadraticRoots function you wrote(return the # of real roots and the assign root values to x1 and x2) to determine*My Code:*

```
int quadraticRoots (double a, double b, double c, double& x1, double& x2);
int circleIntersections (double h, double k, double r, double& x1, double& x2);
int quadraticRoots (double a, double b, double c, double& x1, double& x2)
{
int numberOfroots;
double discriminant = ( (b * b) - (4.0 * a * c) ); //will tell how many real roots
if( discriminant < 0)
{
numberOfroots=0;
}
else if( discriminant == 0)
{
numberOfroots=1;
x1= (-b + ( sqrt( (b*b)-(4*a*c) ) ) ) /(2*a);
}
else
{
numberOfroots=2;
x1= (-b + ( sqrt( (b*b)-(4 * a * c) ) ) ) /(2*a);
x2= (-b - ( sqrt( (b*b)-(4 * a * c) ) ) ) /(2*a);
}
return numberOfroots;
}
int circleIntersections (double h, double k, double r, double& x1, double& x2)
{
if(quadraticRoots(h,k,r,x1,x2)==0)
cout<<"No x intercepts occurs in this circle.";
else if(quadraticRoots(h,k,r,x1,x2)<0)
cout<<"There is one x intercept and it is: \n"<<x1;
//(x - h)^2 + k^2= r^2
else if(quadraticRoots(h,k,r,x1,x2)>0)
{
cout<<"There are two x intercepts: \n\n";
cout<<x1<<" & "<<x2;
}
return 0;
}
int main()
{
double a=3, b=2,c=3,x1,x2,h,k,r;
cout<<"The number of real roots are: ";
cout<<quadraticRoots(a,b,c,x1,x2)<<"\n";
cout<<"Real roots: "<<x1<<" & "<<x2<<"\n\n";
cout<<"To determine the zero-points of a circle....\n"
<<"Please enter '(h,k)' coordinates that are the circle's centerpoint: ";
cin>>h>>k;
cout<<"And please enter the circle's radius: ";
cin>>r;
circleIntersections (h,k,r,x1,x2);
return 0;
}
```

*Edited 4 Years Ago by noblepants*