-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtriangles.cpp
More file actions
61 lines (48 loc) · 861 Bytes
/
triangles.cpp
File metadata and controls
61 lines (48 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <iostream>
#include <cmath>
class Point
{
public:
int x, y;
Point()
{
}
Point(int _x, int _y)
{
x = _x;
y = _y;
}
};
class Segment
{
public:
Point point1;
Point point2;
Segment()
{
}
Segment(Point p1, Point p2)
{
point1 = p1;
point2 = p2;
}
double segmentLen()
{
return sqrt((point2.x - point1.x) * (point2.y - point1.y));
}
};
class Triangle
{
public:
Segment side1;
Segment side2;
Segment side3;
double Perimetr()
{
return sqrt((side1.point2.x - side1.point1.x) * (side1.point2.y - side1.point1.y)) + sqrt((side2.point2.x - side2.point1.x) * (side2.point2.y - side2.point1.y)) + sqrt((side3.point2.x - side3.point1.x) * (side3.point2.y - side3.point1.y));
}
};
int main()
{
system("pause");
}