题解 | #计算三角形的周长和面积#
计算三角形的周长和面积
https://www.nowcoder.com/practice/109a44d649a142d483314e8a57e2c710
#include <iostream>
using namespace std;
#include <cmath>
#include "iomanip"
int main() {
int a, b, c;
double C, S;
cin >> a >> b >> c;
while (a + b < c || a + c < b || b + c < a) {
cin >> a >> b >> c;
}
C = (a + b + c) / 2.0;
S = sqrt(C * (C - a) * (C - b) * (C - c));
cout << "circumference=" << fixed << setprecision(
2) << C * 2.0 << " " << "area=" << S << endl;
}
// 64 位输出请用 printf("%lld")

