Advertisement
DaniDori

Untitled

Feb 18th, 2023
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. double rast(int x1, int y1, int x2, int 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;
  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. cout << sqrt(p*(p - a)*(p - b)*(p - c));
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement