[ create a new paste ] login | about

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

C, pasted on Jul 20:
#include <stdio.h>
#include <math.h>

void calc(double a, double b, double c, double *x, double *y, double *z) {
  *x = acos((b * b + c * c - a * a) / (2.0 * b * c)) * 180.0 / M_PI;
  *y = acos((c * c + a * a - b * b) / (2.0 * c * a)) * 180.0 / M_PI;
  *z = acos((a * a + b * b - c * c) / (2.0 * a * b)) * 180.0 / M_PI;
}

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((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  b = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
  c = sqrt((x3 - x1) * (x3 - x1) + (y3 - y1) * (y3 - y1));
  calc(a, b, c, &u, &v, &w);
  printf("> %f, %f, %f\n", u, v, w);
  return 0;
}
/* end */


Output:
1
2
3
4
In function `calc':
undefined reference to `acos'
undefined reference to `acos'
undefined reference to `acos'


Create a new paste based on this one


Comments: