- circle, Circles, Geometric, Geometric-Lines, Mathematical

Length of intercept cut off from a line by a Circle

#include using namespace std;  double radius(int a, int b, int c){            int g = a / 2;    int f = b / 2;          if (g * g + f * f – c < 0)        return (-1);          return (sqrt(g * g + f * f - c));}  double centerDistanceFromLine(int a, int b,                              int i, int j,                              int k){        int g = a / 2;    int f = b / 2;              double distance        = fabs(i * g + j * f + k)          / (sqrt(i * i + j * j));          if (distance < 0)        return (-1);          return distance;}  void interceptLength(int a, int b, int c,                     int i, int j,                     int k){        double rad = radius(a, b, c);              double dist = centerDistanceFromLine(        a, b, i, j, k);          if (rad < 0 || dist < 0) {        cout rad) {        cout