海伦公式 C++代码
来源:互联网 发布:golang kafka sarama 编辑:程序博客网 时间:2024/04/28 23:11
#include<iostream>
#include<cmath>
using namespace std;
class Tri{
public:
Tri(double r=0.00);
void print();
Tri operator +(Tri c);
private:
double real;
};
Tri::Tri(double r)
{
real=r;
}
Tri Tri::operator+(Tri c)
{
Tri t;
t.real=real+c.real;
return t;
}
void Tri::print()
{
printf("%.2lf\n",real);
}
int main()
{
double a,b,c;
double d,e,f;
double q,w;
double s1,s2;
while(cin>>a>>b>>c>>d>>e>>f)
{
q=(a+b+c)/2;
s1=sqrt(q*(q-a)*(q-b)*(q-c));
printf("%.2lf",s1);
cout<<" ";
w=(d+e+f)/2;
s2=sqrt(w*(w-d)*(w-e)*(w-f));
printf("%.2lf",s2);
cout<<" ";
Tri n1(s1),n2(s2),n3;
n3=n1+n2;
n3.print();
}
return 0;
#include<cmath>
using namespace std;
class Tri{
public:
Tri(double r=0.00);
void print();
Tri operator +(Tri c);
private:
double real;
};
Tri::Tri(double r)
{
real=r;
}
Tri Tri::operator+(Tri c)
{
Tri t;
t.real=real+c.real;
return t;
}
void Tri::print()
{
printf("%.2lf\n",real);
}
int main()
{
double a,b,c;
double d,e,f;
double q,w;
double s1,s2;
while(cin>>a>>b>>c>>d>>e>>f)
{
q=(a+b+c)/2;
s1=sqrt(q*(q-a)*(q-b)*(q-c));
printf("%.2lf",s1);
cout<<" ";
w=(d+e+f)/2;
s2=sqrt(w*(w-d)*(w-e)*(w-f));
printf("%.2lf",s2);
cout<<" ";
Tri n1(s1),n2(s2),n3;
n3=n1+n2;
n3.print();
}
return 0;
}
世界这么大自己去看看具体,,本人不想讲
0 0
- 海伦公式 C++代码
- 海伦公式
- 海伦公式
- 海伦公式
- 海伦公式
- 海伦公式
- 海伦公式
- 海伦公式
- 海伦公式
- 海伦公式
- c语言:用海伦公式求三角形的面积
- uva 11524 海伦公式
- 练习-海伦公式
- 数学公式——海伦公式
- 三角形二(海伦公式)
- NYOJ 815 三角形【海伦公式】
- 寻找三角形 (海伦公式)
- 三角形面积之海伦公式
- mysql安装时报start service错。解决办法~
- Spring整合Hibernate问题
- 黑马程序员——2,零碎的JAVA基础
- 黑马程序员-------------多线程基础概述(Thread -- Runable)
- #猜猜看#连接数据库计算猜对次数猜错次数
- 海伦公式 C++代码
- Android基础之ListView的使用详解
- 欢迎使用CSDN-markdown编辑器
- LeetCode_Disjoint-Set_Longest Consecutive Sequence
- phpcms 添加顶踩功能
- 实现安卓英汉词典
- java求两个数的最大公约数和最小公倍数
- 用递归方法计算行列式的值
- 软件测试