实现三角形类Tri,数据成员包含三个Point类对象,实现判断两个三角形全等

2023-11-19

实现三角形类Tri,数据成员包含三个Point类对象,

  • 实现从屏幕输入三个点的坐标,用于构造Tri的一个对象
  • 实现函数Cong(),判断两个三角形是否全等
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
class Point
{
   
public:
    Point()
    {
   
        x = 0;
        y = 0;
    }
    Point(float new_x, float new_y)
    {
   
        x = new_x;
        y = new_y;
    }
    float x, y;
};

class Tri
{
   
public:
    Tri(Point &new_a, Point &new_b, Point &new_c)
    {
   
        
        a = new_a;
        b = new_b;
        c = new_c;
        
        // 三边长度
        x = sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
        y = sqrt((b.x - c
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

实现三角形类Tri,数据成员包含三个Point类对象,实现判断两个三角形全等 的相关文章

随机推荐