
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.
Решение Pascal
Delphi/Pascal
program Case5;
var
N,A,B:Integer;
begin
Write('Введите номер действия: ');
Readln(N);
Write('Введите число A: ');
Readln(A);
Write('Введите число B: ');
Readln(B);
Case N of
1: Writeln(A+B);
2: Writeln(A-B);
3: Writeln(A*B);
4: Writeln(A/B);
end;
end.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
program Case5;
var
N,A,B:Integer;
begin
Write('Введите номер действия: ');
Readln(N);
Write('Введите число A: ');
Readln(A);
Write('Введите число B: ');
Readln(B);
Case N of
1: Writeln(A+B);
2: Writeln(A-B);
3: Writeln(A*B);
4: Writeln(A/B);
end;
end.
Решение C
C
#include <stdio.h>
int main(void)
{
system("chcp 1251");
int n;
float a,b;
printf("N:") ;
scanf ("%i", &n);
printf("A:") ;
scanf ("%f", &a);
printf("B:") ;
scanf ("%f", &b);
switch (n) {
case 1:
printf("%f\n",a+b) ;
break;
case 2:
printf("%f\n",a-b) ;
break;
case 3:
printf("%f\n",a*b) ;
break;
case 4:
printf("%f\n",a/b) ;
break;
}
return 0;
}
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
#include <stdio.h>
int main(void)
{
system("chcp 1251");
int n;
float a,b;
printf("N:") ;
scanf ("%i", &n);
printf("A:") ;
scanf ("%f", &a);
printf("B:") ;
scanf ("%f", &b);
switch (n) {
case 1:
printf("%f\n",a+b) ;
break;
case 2:
printf("%f\n",a-b) ;
break;
case 3:
printf("%f\n",a*b) ;
break;
case 4:
printf("%f\n",a/b) ;
break;
}
return 0;
}
Объяснение: