第一题
来源:互联网 发布:生活用品 淘宝店 编辑:程序博客网 时间:2024/04/30 02:34
#include <iostream>
#include <cmath>
using namespace std;
void input(double& a,double& b,double& c)
{cout<<"please input a,b,c:";
cin>>a>>b>>c;
}
void area(double a,double b,double c)
{double s,area;
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;}
}
int main()
{double a=2,b=3,c=5;
input(a,b,c);
area(a,b,c);
return 0;
}
#include <cmath>
using namespace std;
void input(double& a,double& b,double& c)
{cout<<"please input a,b,c:";
cin>>a>>b>>c;
}
void area(double a,double b,double c)
{double s,area;
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;}
}
int main()
{double a=2,b=3,c=5;
input(a,b,c);
area(a,b,c);
return 0;
}
0 0
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 第一题
- 解决eclipse中自带的maven搜索不到非本地第三方包问题
- spring tx:advice 和 aop:config 配置事务
- nginx或tomcat的性能优化调整详解
- maven2中profile的介绍与使用
- eclipse配置python开发插件
- 第一题
- 网络配置命令
- 2980 买帽子
- 如何进行nginx或tomcat的性能调优(优秀推荐)
- Permission denied 与 553 Permission denied 错误解决方法
- Android:使用Socket网络通信时异常:java.net.SocketException: socket closed
- JFreeChart—输出折线图
- 第二题
- 第三题