The_Law

Untitled

Dec 28th, 2017
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.83 KB | None | 0 0
  1. void culc(void)
  2. {
  3.     FILE* in = fopen("input", "r");
  4.     double x1,y1, x2, y2, x3, y3;
  5.     fscanf(in, "%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &x3, &y3);
  6.    
  7.     double s = ((x1 - x3) * (y2 - y3) - (y1 - y3) * (x2 - x3)) / 2;
  8.  
  9.     printf("%f\n", abs(s));
  10.  
  11.     double m1x = (x1 + x2) / 2;
  12.     double m1y = (y1 + y2) / 2;
  13.    
  14.     double m2x = (x2 + x3) / 2;
  15.     double m2y = (y2 + y3) / 2;
  16.  
  17.     double m3x = (x1 + x3) / 2;
  18.     double m3y = (y1 + y3) / 2;
  19.  
  20.     double res1 = Sqr(m1x - x3) + Sqr(m1y - y3);
  21.     double res2 = Sqr(m2x - x1) + Sqr(m2y - y1);
  22.     doubel res3 = Sqr(m3x - x2) + Sqr(m3y - y2);
  23.  
  24.     if (res1 > res2 && res1 > res3)
  25.         printf("%f", Sqrt(res1));
  26.  
  27.     if (res2 > res1 && res2 > res3)
  28.         printf("%f", Sqrt(res2));
  29.  
  30.     if (res3 > res2 && res3 > res1)
  31.         printf("%f", Sqrt(res3));
  32. }
Advertisement
Add Comment
Please, Sign In to add comment