实现三角形类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