Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double rast(double x1, double y1, double x2, double y2) {
- return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- }
- int main() {
- double x1, y1, x2, y2, x3, y3, a, b, c, p = 0, ans;
- cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
- a = rast(x1, y1, x2, y2);
- b = rast(x2, y2, x3, y3);
- c = rast(x1, y1, x3, y3);
- p = (a + b + c) / 2;
- ans = sqrt(p * (p - a) * (p - b) * (p - c));
- printf("%.1f", ans);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement