海伦公式

来源:互联网 发布:激活windows是什么意思 编辑:程序博客网 时间:2024/04/28 20:48

海伦公式

#include<iostream>
#include<string>
#include<math.h>
#include<string.h>
using namespace std;
int main()
{
 int a,b,c,p,s;
 cin>>a>>b>>c;
 if (a+b>c && a+c>b && b+c>a)
 {
  p=(a+b+c)/2;
  s=sqrt(p*(p-a)*(p-b)*(p-c));
  cout<<"s="<<s;
 
 }
 else cout<<"can't"<<endl;
 return 0;
}

0 0
原创粉丝点击