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
| #include <iostream.h>
#include <conio.h>
#include <math.h>
double Distance(int, int, int, int);
int main()
{
int Points[2][5];
double ab, ae, bc, be, cd, da, ea;
for(int i=0; i<5; i++)//
{
cout << "Enter " << i+1 << " point:\nX: ";
cin >> Points[0][i];
cout << "Y: ";
cin >> Points[1][i];
}
ab=Distance(Points[0][0], Points[1][0], Points[0][1], Points[1][1]);
ae=Distance(Points[0][0], Points[1][0], Points[0][4], Points[1][4]);
bc=Distance(Points[0][1], Points[1][1], Points[0][2], Points[1][2]);
be=Distance(Points[0][1], Points[1][1], Points[0][4], Points[1][4]);
cd=Distance(Points[0][2], Points[1][2], Points[0][3], Points[1][3]);
da=Distance(Points[0][3], Points[1][3], Points[0][0], Points[1][0]);
ea=Distance(Points[0][4], Points[1][4], Points[0][0], Points[1][0]);
//...ГІГіГІ ìîæГ*Г® ïåðåáðГ*ГІГј ГўГ±ГҐ ñëó÷Г*ГЁ Г*Г® Гі ГІГҐГЎГї Г*Г*ГЇГЁГ±Г*Г*Г® Г·ГІГ® òîëüêî ГІГ*ГЄГЁГҐ.
cout <<ab<<" "<<ae<<" "<<bc<<" "<<be<<" "<<cd<<" "<<da<<" "<<ea<< endl;
getch();
//...Г* Г¤Г*ëüøå Г±Г*Г¬ óæå ГЁГ№ГЁ ïëîùГ*äü.
}
double Distance(int Fx, int Fy, int Sx, int Sy)
{
double res;
res=sqrt(pow(Fx-Sx, 2)+pow(Fy-Sy, 2));
return res;
} |