第一题
来源:互联网 发布:电视软件看电影免费 编辑:程序博客网 时间:2024/04/29 15:55
#include <iostream>
#include <cmath>
using namespace std;
int main()
{double a,b,c,s,area;
cout<<"please input a,b,c:";
cin>>a>>b>>c;
if (a+b<=c)
cerr<<"a+b<=c,error!"<<endl;
else if(b+c<=a)
cerr<<"b+c<=a,error!"<<endl;
else if (c+a<=b)
cerr<<"c+a<=b,error!"<<endl;
else
{s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
cout<<"area="<<area<<endl;}
return 0;
}
#include <cmath>
using namespace std;
int main()
{double a,b,c,s,area;
cout<<"please input a,b,c:";
cin>>a>>b>>c;
if (a+b<=c)
cerr<<"a+b<=c,error!"<<endl;
else if(b+c<=a)
cerr<<"b+c<=a,error!"<<endl;
else if (c+a<=b)
cerr<<"c+a<=b,error!"<<endl;
else
{s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
cout<<"area="<<area<<endl;}
return 0;
}
0 0
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 微软经典的算法面试100题之32题
- 关于linux和windows下的句柄和指针
- java学习之旅06--标识符_unicode和GBK_各种字符集的关系
- Region Filling and Object Removal by Exemplar-Based Image Inpainting-code-2004
- 第二题
- 第一题
- 写个博客吧
- 3
- 第二题
- 有道词典的查询
- 表关系:一对一的两种方式
- 读取文件或超大文件的几种方式
- linux sun/awt/X11GraphicsEnvironment
- 第三题