#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    float x1, y1, x2, y2, x3, y3;
    cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;

    float area = fabs((x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2)) / 2.0);
    cout << fixed << setprecision(2) << area << endl;

    return 0;
}
C++ 计算三角形面积 - 精确到小数点后两位

原文地址: https://www.cveoy.top/t/topic/uK0 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录