#include <iostream>
#include<cmath>
#include<stdlib.h>
using namespace std;
class point
{
public:
float x1, x2, y1, y2, z1, z2;
point(float x1, float x2, float y1, float y2, float z1, float z2)
:x1(x1), x2(x2), y1(y1), y2(y2), z1(z1), z2(z2) {
}
float a() {
return (x1 - y1) * (x1 - y1) + (x2 - y2) * (x2 - y2); }
float b() {
return (x1 - z1) * (x1 - z1) + (x2 - z2) * (x2 - z2); }
float c() {
return (y1 - z1) * (y1 - z1) + (y2 - z2) * (y2 - z2); }
};
class line :public point
{
public:
line(float x1, float x2, float y1, float y2, float z1, float z2)
:point(x1, x2, y1, y2, z1, z2) {
}
float len1() {
return sqrt(a()); }
float len2() {
return sqrt(b()); }
float len3() {
return sqrt(c()); }
};
class triangle :public line
{
private:
float a = len1(), b = len2(), c = len3();
public:
//triangle() :line(0,0,0,0,0,0){}
triangle(float x1, float x2, float y1, float y2, float z1, float z2)
:line(x1, x2, y1, y2, z1, z2) {
}
bool triangle_condition();
void triangle_judge();
void triangle_area();
void output_();
};
void menu_show() {
cout << "***************************************" << endl << endl
<< "*** 三角形的种类和面积-功能菜单 ***" << endl << endl
<< "* 1.输入坐标 *" << endl << endl
<< "* 2.判断三角形种类 *" << endl << endl
<< "* 3.根据构成的三角形计算三角形面积 * " << endl << endl
<< "* 3.根据构成的三角形计算三角形面积 * " << endl << endl
<< "* 3.根据构成的三角形计算三角形面积 *" << endl << endl
<< "* 4.输出结果 *" << endl << endl
<< "* 5.退出运行 *" << endl << endl
<< "***************************************" << endl << endl;
}
bool triangle::triangle_condition()//三角形构成条件
{
if (a + b > c&& a + c > b&& b + c > a)
return 1;
else
return 0;
}
void triangle::triangle_judge() {
if
c++//2.三角形的种类和面积//20191211
最新推荐文章于 2024-03-30 19:30:21 发布