[ create a new paste ] login | about

Link: http://codepad.org/mXXBpTFc    [ raw code | output | fork ]

C, pasted on May 23:
#include <stdio.h>
#include <math.h>
#define D(x) ((x) * (x))
double f(double a, double b, double c) {
  return acos((D(b) + D(c) - D(a)) / (2.0 * b * c));
}

int main() {
  double a, b, c;
  double u, v, w;
  double x1, y1, x2, y2, x3, y3;
  printf("1: "); scanf("%lf %lf", &x1, &y1);
  printf("2: "); scanf("%lf %lf", &x2, &y2);
  printf("3: "); scanf("%lf %lf", &x3, &y3);
  a = sqrt(D(x1 - x2) + D(y1 - y2));
  b = sqrt(D(x2 - x3) + D(y2 - y3));
  c = sqrt(D(x3 - x1) + D(y3 - y1));
  u = f(a, b, c);
  v = f(b, c, a);
  w = f(c, a, b);
  printf("ragian: %g, %g, %g\n", u, v, w);
  printf("anglar: %g, %g, %g\n", u / M_PI * 180, v / M_PI * 180, w / M_PI * 180);
  return 0;
}
/* end */


Output:
1
2
In function `f':
undefined reference to `acos'


Create a new paste based on this one


Comments: