Advertisement
armeer

Untitled

Jul 25th, 2019
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. struct point {
  6.     double x, y;
  7. };
  8.  
  9. double square (point a, point b, point c) {
  10.     b.x -= a.x;
  11.     b.y -= a.y;
  12.     c.x -= a.x;
  13.     c.y -= a.y;
  14.     return abs(b.x * c.y - b.y * c.x) / 2.;
  15. }
  16.  
  17. double dist (point a, point b) {
  18.     return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
  19. }
  20.  
  21. int main()
  22. {
  23.     cout << fixed << setprecision(9);
  24.     point a, b, c;
  25.     cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y;
  26.     cout << square(a, b, c);
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement