1100606 - 计算三角形面积

include

include

include

using namespace std; int main() {

float x1, y1, x2, y2, x3, y3;
cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
double a = sqrt( pow(x1 - x2, 2) + pow(y1 - y2, 2) );        // 求出边a的长度
double b = sqrt( pow(x2 - x3, 2) + pow(y2 - y3, 2) );        // 求出边b的长度
double c = sqrt( pow(x3 - x1, 2) + pow(y3 - y1, 2) );        // 求出边c的长度
double p = (a + b + c) / 2;                                  // 求出半周长
double S = sqrt( p * ( p - a ) * ( p - b ) * ( p - c ) );    // 求出面积
cout << fixed << setprecision(2) << S;
return 0;

}