采用海伦公式,求三角形的面积,三角形的三个边从键盘输入
#include<iostream>
#include<cmath>
using namespace std;
int main() {
int a, b, c,s,p;
cout << "a,b,c=";
cin >> a >> b >> c;
p = (a + b + c) / 2;
s = sqrt(p * (p - a) * (p - b) * (p - c));
cout << s;
return 0;
}
采用海伦公式,求三角形的面积,三角形的三个边从键盘输入
#include<iostream>
#include<cmath>
using namespace std;
int main() {
int a, b, c,s,p;
cout << "a,b,c=";
cin >> a >> b >> c;
p = (a + b + c) / 2;
s = sqrt(p * (p - a) * (p - b) * (p - c));
cout << s;
return 0;
}