解题思路:
注意事项:
参考代码:
#include<iostream> #include<math.h> using namespace std; int main() { double x1, y1, x2, y2, x3, y3, p, s, a, b, c; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; a = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3)); b = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3)); c = sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); p = 0.5 * (a + b + c); s = sqrt(p * (p - a) * (p - b) * (p - c)); printf("%.2lf", s); return 0; }
0.0分
0 人评分