Kristina_procedure

Dec 18th, 2012
93
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. {Найти (в градусах, минутах и секундах) все углы треугольника,
2. вершины которого заданы координатами (x1, y1), (x2, y2), (x3, y3).}
3.
4. {s = ((x2 - x1)^2+(y2-y1)^2)^(1/2)
5. где (x1,y1) и (x2, y2) - это координаты начала и конца отрезка
6. cos (ang) = a/(s1*s2)
7. где a - скалярное произведение векторов s1 и s2,
8. а s1 и s2 - стороны треугольника.}
9.
10. var x1,y1,x2,y2,x3,y3:integer; a,b,c,s1,s2,s3:real;
11. procedure work(x1,y1,x2,y2,x3,y3:integer; var a1:real; var b1:real; var c1:real);
12. begin
13.     s1:=sqrt(abs(sqr(x2-x1)+sqr(y2-y1)));
14.     s2:=sqrt(abs(sqr(x3-x2)+sqr(y3-y2)));
15.     s3:=sqrt(abs(sqr(x1-x3)+sqr(y1-y3)));
16.     a:=arctan(SQRT(1-sqr(cos(s2*s2+s3*s3-s1*s1)/(2*s2*s3)))/cos((s2*s2+s3*s3-s1*s1)/(2*s2*s3)));
17.     b:=arctan(SQRT(1-sqr(cos(s1*s1+s3*s3-s2*s2)/(2*s1*s3)))/cos((s1*s1+s3*s3-s2*s2)/(2*s1*s3)));
18.     c:=arctan(SQRT(1-sqr(cos(s1*s1+s2*s2-s3*s3)/(2*s1*s2)))/cos((s1*s1+s3*s3-s2*s2)/(2*s1*s3)));
19. end;
20.
21. begin
22.     write('Vvedi koordinaty 1:');
23.     readln(x1,y1);
24.     write('Vvedi koordinaty 2:');
25.     readln(x2,y2);
26.     write('Vvedi koordinaty 3:');
27.     readln(x3,y3);
28.     work(x1,y1,x2,y2,x3,y3,a,b,c);
29.     writeLN('Ugol a=',a:6:2,'; Ugol b=',b:6:2,'; Ugol c=',c:6:2);
30. End.
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×