Advertisement
DaniDori

Untitled

Mar 2nd, 2023
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. double rast(double x1, double y1, double x2, double y2) {
  5. return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  6. }
  7. int main() {
  8. double x1, y1, x2, y2, x3, y3, a, b, c, p = 0, ans;
  9. cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
  10. a = rast(x1, y1, x2, y2);
  11. b = rast(x2, y2, x3, y3);
  12. c = rast(x1, y1, x3, y3);
  13. p = (a + b + c) / 2;
  14. ans = sqrt(p * (p - a) * (p - b) * (p - c));
  15. printf("%.1f", ans);
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement