#include<iostream>
#include<iomanip>
#define _USE_MATH_DEFINES
#include<cmath>
using namespace std;
int main()
{
double a, b, c, alfa, beta, gamma;
cout <<"a="; cin >> a;
cout <<"b="; cin >> b;
cout <<"c="; cin >> c;
if (a+b>c && a+c>b && b+c>a)
{
alfa = acos((b*b+c*c-a*a)/(2*b*c))*180/M_PI;
beta = acos((a*a+c*c-b*b)/(2*a*c))*180/M_PI;
gamma = acos((a*a+b*b-c*c)/(2*a*b))*180/M_PI;
cout <<"Angles in degrees:\n";
cout <<setprecision(3)<<fixed<< "alfa=" << alfa << " beta=" << beta << " gamma=" << gamma << endl;
}
else cout << "Triangle absent\n";
system("pause");
return 0;
}
const
AOper: array [0..3] of string = ('+', '-', '*', '/');
var
a, b, Oper: Integer;
r: Real;
begin
Randomize; // инициализация датчика случайных чисел
a := Random (1001);
b := Random (1001);
Oper := Random (4);
case Oper of
0: r := a + b;
1: r := a - b;
2: r := a * b;
3:if b <> 0 then begin
r := a / b;
end else begin
WriteLn ('Произошла ошибка при делении на ноль');
Exit;
end
else r := -1;
end;
WriteLn (a);
WriteLn (b);
WriteLn (Aoper [Oper]);
if (r >= 0) and (r - Trunc (r) = 0) then begin // если в результате получилось положительное целое число
WriteLn ('yes');
WriteLn (r :6 :0);
end else
WriteLn (' no');
ReadLn;
end.
Объяснение:
r - Trunc (r) // это выделение дробной части числа
1 uses graphABC,crt;
2 var i,x,y,x2,y2,x3,y3: integer;
3 begin
4 setwindowsize(500,500);
5 lockdrawing;
6 hidecursor;
7 repeat
8 clearwindow;
9 setpenwidth(1);
10 setbrushcolor(clblack);
11 circle(250,200,20);
12 setbrushcolor(clbrown);
13 rectangle(100,200,400,400);
14 setbrushcolor(clwhite);
15 roundrect(110,210,350,390,40,40);
16 for i:=1 to 10000 do
17 putpixel(random(235)+112,random(171)+215,clblack);
18 setbrushcolor(clblack);
19 for i:=1 to 5 do
20 circle(375,210+(i*25),10);
21 circle(375,370,15);
22 setbrushcolor(clwhite);
23 rectangle(372,360,378,380);
24 setpenwidth(5);
25 x:=250; y:=197;
26 x2:=x-40-random(10);
27 y2:=y-150-random(10);
28 x3:=x++40+random(10);
29 y3:=y-150-random(10);
30 line(x,y,x2,y2);
31 line(x,y,x3,y3);
32 circle(x2,y2,10);
33 circle(x3,y3,10);
34 sleep(2);
35 redraw;
36 until keypressed;
37 end.