Вы находитесь на странице: 1из 7

, .

()
() .

4231

- 2012

..

,
(1, 2, 3 4 ),
. ,
.
1
9
:
,
.
(. ).
: .
(F7). ,
. .
:

, a =2.4, b=2.5

2
9
:
.
1) , .
2)
.
3)
.
4)
, .
5)
.
3
9
:
,
( , ,
). .
,
.
(. ).
:
n.

1
1
1

1* 2 2 * 3
(n 1) * n

n 2

1. , .
.
2. , .
.. Turbo
Pascal
( TurboPascal_polnoe_rukovodstvo.djvu) 939
( 3).
1) : .
2- .
2) Then expected. : 57.
Pascal:
program lab_5;
uses crt;
const m=10;
type Ar = array [1..10] of integer;
procedure lab1_v2(a,b: real);
Var y,x:real;
begin
a:=2.4;
b:=2.5;
y:=a;
x:=7*a;
a:=3/(a-b)+x;
writeln(3);
writeln('a = ----------- = ',a);
writeln(y,' - ',b);
end;
procedure lab1_v1(a,b: real);
Var y,x:real;
begin
a:=2.4;
b:=2.5;
y:=a;
x:=7*a;
a:=3/(a-b)+x;
writeln(3:10);
writeln('a = ----------- = ',a:3:3);
writeln(y:8:1,' - ',b:1:1);
end;
procedure lab2_v1(a,b:integer; var f:integer);
begin
if (a<0) and (b<0) then f:=0 else
if (a mod 2 = 0) and (b mod 2 <>0) then f:=-1 else
if (a mod 2 <> 0) and (b mod 2 =0) then f:=-2 else
if (a mod 2 <> 0) and (b mod 2 <>0) and (a>b) then f:=a*4 else
if (a mod 2 <> 0) and (b mod 2 <>0) and (a>b) then f:=a+b;
end;

procedure lab2_v2(var a,b:integer; var f:integer);

begin
if (a<0) then
if (b<0) then
f:=0;
if (a mod 2 = 0) then
if (b mod 2 <> 0) then
f:=-1;
if (a mod 2 <> 0) then
if (b mod 2 = 0) then
f:=-2;
if (a mod 2 <> 0) then
if (b mod 2 <> 0) then
if (a>b) then
f:=a*4;
if (a mod 2 = 0) then
if (b mod 2 = 0) then
if (a>b) then
f:=a+b;
end;
procedure lab3_v1(n:integer; x:real; var s:real);
Var i:integer;
z:real;
begin
s:=0;
i:=1;
while (i<=n) do
begin
write(' ',i, '-e 2: ');
z:=1/((x-1)*x);
s:=s+z;
i:=i+1;
end;
end;
procedure lab3_v2(n:integer; x:real; var s:real);
Var i:integer;
z:real;
begin
s:=0;
i:=1;
repeat
write(' ',i, '-e 2: ');
z:=1/((x-1)*x);
s:=s+z;
i:=i+1;
until (i=n+1);
end;
procedure lab3_v3(var n:integer; x:real; var s:real);
Var i:integer;
z:real;

begin
s:=0;
i:=1;
for i:=1 to n do
begin
write(' ',i, '-e 2: ');
z:=1/((x-1)*x);
s:=s+z;
end;
end;
procedure lab4_vvod(n: integer; var a: Ar);
var i:integer;
begin
randomize;
for i:=1 to n do a[i]:=random(11)-5;
end;
procedure lab4_print(n: integer; a: Ar);
var i:integer;
begin
for i:=1 to n do
if a[i]>0 then
write(a[i]:5);
end;
procedure lab4_obrabotka(n: integer; var a: Ar);
var i:integer;
begin
for i:=1 to n do
write(a[i]:5);
end;
var comanda: byte;
massiv: Ar;
x,y:real;
x1,y1,z1:integer;
begin
clrscr;
repeat
clrscr;
writeln(' 1 9. 1 - lab1_v1, 2 - lab1_v2, 3 - lab2_v1, 4- lab2_v2');
writeln('5 - lab3_v1, 6 - lab3_v2, 7 - lab3_v3, 8 - lab4, 9 - ');
case comanda of
1: begin
Writeln('Laboratornaya 1. Versiya 1');
Writeln('Vvedite 2 chisla');
lab1_v1(x,y);
end;
2: begin
Writeln('Laboratornaya 1. Versiya 2');
Writeln('Vvedite 2 chisla');

lab1_v2(x,y);
end;
3: begin
Writeln('Laboratornaya 2. Versiya 1');
Writeln('Vvedite 2 argymenta fynkcii');
lab2_v1(x1,y1,z1);
Writeln('f=',z1);
end;
4: begin
Writeln('Laboratornaya 2. Versiya 2');
Writeln('Vvedite 2 argymenta fynkcii');
Lab2_v1(x1,y1,z1);
Writeln('f=',z1);
end;
5: begin
Writeln('Laboratornaya 3. Versiya 1');
Writeln('Vvedite 2 argymenta fynkcii');
write(' : ');
lab3_v1(x1,x,y);
writeln(' : ',y:5:2);
end;
6: begin
Writeln('Laboratornaya 3. Versiya 2');
Writeln('Vvedite 2 argymenta fynkcii');
write(' : ');
lab3_v2(x1,x,y);
writeln(' : ',y:5:2);
end;
7: begin
Writeln('Laboratornaya 3. Versiya 3');
Writeln('Vvedite 2 argymenta fynkcii');
write(' : ');
lab3_v2(x1,x,y);
writeln(' : ',y:5:2);
end;
8: begin
writeln (' 4');
lab4_vvod(m, massiv);
writeln (' :');
lab4_print(m, massiv);
lab4_obrabotka(m, massiv);

writeln(' :');
lab4_print(m, massiv);
end;
9: begin
writeln(' ');
end
else
begin
writeln (' ');
end;
end;
until comanda =9;
end.

Нижнее меню

Получите наши бесплатные приложения

Авторское право © 2021 Scribd Inc.