题目
关于C++的简单算三角形面积
头文件CT.h
#ifndef CT
#define CT
class CTriangle
{
private:
float n_a,n_b,n_c;
public:
//CTriangle();
//CTriangle(float a,float b,float c);//用构造函数赋值
void SetLine(float a,float b,float c);
float GetArea();
};
#endif
还有CPP文件Triangle.cpp
#include "CT.h"
#include
#include "math.h"
using namespace std;
void CTriangle::SetLine(float a,float b,float c)
{
n_a=a;
n_b=b;
n_c=c;
}
float CTriangle::GetArea()
{
float s=(n_a+n_b+n_c)/2;
float area=sqrt(s*(s-n_a)*(s-n_b)*(s-n_c));
return area;
}
实现d的cpp文件CTriangle1.cpp
#include "Triangle.cpp"
void main()
{
CTriangle t;
t.SetLine(3.0,4.0,5.0);
cout
头文件CT.h
#ifndef CT
#define CT
class CTriangle
{
private:
float n_a,n_b,n_c;
public:
//CTriangle();
//CTriangle(float a,float b,float c);//用构造函数赋值
void SetLine(float a,float b,float c);
float GetArea();
};
#endif
还有CPP文件Triangle.cpp
#include "CT.h"
#include
#include "math.h"
using namespace std;
void CTriangle::SetLine(float a,float b,float c)
{
n_a=a;
n_b=b;
n_c=c;
}
float CTriangle::GetArea()
{
float s=(n_a+n_b+n_c)/2;
float area=sqrt(s*(s-n_a)*(s-n_b)*(s-n_c));
return area;
}
实现d的cpp文件CTriangle1.cpp
#include "Triangle.cpp"
void main()
{
CTriangle t;
t.SetLine(3.0,4.0,5.0);
cout
提问时间:2020-12-03
答案
实现d的cpp文件CTriangle1.cpp
把这个文件里的#include "Triangle.cpp"换成#include"CT.h"
把这个文件里的#include "Triangle.cpp"换成#include"CT.h"
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
最新试题
- 1这幢楼真高呀改夸张句
- 2社会调查:揭摆社会不文明现象,并择一例进行分析,阐述自己的看法与认识.写一份调查报告.
- 3Do you think _________ an English film tomorrow night? A. is there B. there is going to be C. there
- 4求不等式x-(3x-10)≥6的非负整数解.
- 5_____of the students come to school at 6:30
- 6帮忙算一算,在10天施工中,其中有3天下雨,4天设备坏,都是随机的,那么有效施工天数是多少?怎么算的啊
- 7用近似公式计算醋酸标准解离常数的条件
- 8学习英语的最佳方法就是使用它.英语翻译
- 9know for certain是什么意思?
- 10《桥之美》中的“如果坐小船沿桥缓缓地看一遍,你会感到像读了一篇史诗一样满足.”这句话怎么理解?
热门考点
- 1用一副三角板(两块)画角,不可能画出的角的度数是( ) A.15° B.55° C.75° D.135°
- 2英语翻译
- 3英语填空many students read storybooks () fun
- 4(2010•湖南三模)已知两个力的合力大小为18N,则这两个力不可能是( ) A.7N,8N B.18N,18N C.10N,20N D.20N,28N
- 5I have a book改变成单数,复数 一般疑问句和肯定句
- 6当a=_时,这个式子(36-4a)÷8的结果是0;当a=_时,这个式子(36-4a)÷8的结果是1.
- 7有一辆功率是60kW的汽车,发动机的效率为20%,当汽车以54km/h的速度在普通公路上行驶了100km的路程后接着又在高速公路上以100km/h的速度行驶了同样的路程,问在高速公路上行驶比在普通公路
- 8没有什么不可能,没有什么不可以怎么翻译 英文的正确翻译
- 9已知0<a<pai,tan=-2
- 10下列具有基因内启动子是