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

. ..

22

2-

22
1 2 .

3. .
. X Y.

(X,Y)
.
.
. x y. f(x,y):
x 2 2 y + xy, x < y;

f ( x , y) = 0,
x = y;
y 3 2 x + 1,
x > y.

4. . .
A. .
. .
.
. , =10-4, 10-5.
1

: x sin x 2 dx .
0

1
: (cos1 1). ,
2

5. . . .
. . 45
. : ,
- .
. , / .
N*N, - *.
.

6. .
. 10 . 10
, .
: -
- .
.

7. .
S(6,6). ,
.

8. .
, .
:
, .
, .

-2-

9. . Delphi.
, . .
:
1) ;
2) ;
3) .
N*M. ,
.

10. . . .
, .
.
1. - KOR
f(x)=0 c 0.1
-x2+sin(x/2)=1
x5+3x3+x2+1=0
2. ,
N*N, , .
. .

11. .
, ().
, :
+++++++++
(9 )
----------(11 )
.
.
.
+++++++ . . . . . . . . .++++++
(21 )
-------. . . . . . ----(19 )
.
.
.
+++++++++
(9 )

12. . .
x1, x2, x3... xn n>2.
, ,
.

13. .
F, . ,
. G .

14. .
, . ,
, .
- . : . : ,
. ,
. ( ).

15.
16. . .
VCL.
, , ,
.
.
1. , .
2. , .
3. ,
. .
-3-

3. .
. X Y. (X,Y)
. .

Listing 3a
{
;--------------------------------------------------------------; Program Name: theme3a from variant22
; Program Description:

; Author: Rodin Andrey


; Date Created: 01.12.2008
; Last Modification Date: 02.12.2008
;--------------------------------------------------------------}
program theme3a;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
x,y:real;
chose:char;
label
repeate;
begin
repeate:
writeln('Please type X and Y');
Readln (x,y);
if (x*y>=0) and (x<=sqrt(1-y*y)) then writeln ('Success')
else
writeln ('Sucks');
writeln('PRESS Y to REPEATE or ANY KEY to EXIT');
readln(chose);
if (chose = 'Y') or (chose = 'y') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.

-4-

result

3. .
. x y. f(x,y):
x 2 2 y + xy,

f ( x , y) = 0,

y 3 2 x + 1,

x < y;
x = y;
x > y.

Listing 3b
{
;---------------------------------------------------------------------; Program Name: theme3b from variant22
; Program Description:
; Author: Rodin Andrey
; Date Created: 02.12.2008
; Last Modification Date: 02.12.2008
;---------------------------------------------------------------------}
program theme3b;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
funk,x,y:word;
chose:char;
label
repeate;
begin
repeate:
funk := 0;
writeln('Please type X and Y');
Readln (x,y);
-5-

if (x=y) then
begin
funk := 0;
writeln ('x=y')
end;
if (x<y) then
begin
funk:=x*x-2*y+x*y;
writeln ('x<y')
end;
if (x>y) then
begin
funk:=y*y*y-2*x+1;
writeln ('x>y')
end;
writeln('*************************************');
write('RESULT ');
writeln(funk);
writeln('*************************************');
writeln('PRESS Y to REPEATE or ANY KEY to EXIT');
readln(chose);
if (chose = 'Y') or (chose = 'y') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.

result

-6-

4. . .
A. .
. .
.
:

-7-

4:
{
;---------------------------------------------------------------------; Program Name: theme4a from variant22
; Program Description:
; Author: Rodin Andrey
; Date Created: 02.12.2008
; Last Modification Date: 02.12.2008
;---------------------------------------------------------------------}
program theme4a;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
k,x:integer;
i:real;
chose:char;
label
repeate;
begin
repeate:
k:=0;
x:=0;
i:=0;
writeln('Please type Any INTEGER UNSICNED NUMERIC DATA');
readln(x);
i:=x;
repeat
i:=i/10;
k:=k+1;
until (i<=1);
writeln('*************************************');
write ('ARE YOU TYPED: ');
writeln (x);
write ('WHIS WORD INCLUDE: ');
write (k);
writeln (' SYMBOL''S');
writeln('*************************************');
writeln('PRESS Y to REPEATE or ANY KEY to EXIT');
readln(chose);
if (chose = 'Y') or (chose = 'y') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;

end.
-8-

-9-

4. . .
. , =10-4, 10-5.
1

: x sin x 2 dx .
0

: 1 (cos1 1). ,
2
begin

Iteracii1:=0;
Iteracii2:=0;
res:=0;
x:=eps1;

while((Cos(1)1))/2 <= res do

res:=x*SIn(x*x);
x:=x+eps1;
iteracii1:=iteracii1+1;

X
iteracii1

res:=0;
x:=eps1;

while((Cos(1)1))/2 <= res do

res:=x*SIn(x*x);
x:=x+eps2;
iteracii1:=iteracii2+2;

X
iteracii2

End

- 10 -

4b
{
;---------------------------------------------------------------------; Program Name: theme4b from variant22
; Program Description:
;
; Program Status: Working
; Author: Rodin Andrey
; Date Created: 19.05.2008
; Last Modification Date: 19.05.2008
;---------------------------------------------------------------------}
program theme4b;
{$APPTYPE CONSOLE}
uses
SysUtils;
var
eps1:real=0.0001;
eps2:real=0.00001;
y,x:real;
Iteracii1, Iteracii2 :integer;
res:real;
begin
Iteracii1:=0;
Iteracii2:=0;
res:=0;
x:=eps1;
while ((Cos(1)-1))/2 <= res do
begin
res:=x*SIn(x*x);
x:=x+eps1;
iteracii1:=iteracii1+1;
end;
writeln('eps1 = 0.0001');
write('Znachenie X '); writeln(x:2:2);
write('Kolichestvo Iteracii ');
writeln(iteracii1);
writeln('');

writeln(''); writeln('');

res:=0;
x:=eps2;
while ((Cos(1)-1))/2 <= res do
begin
res:=x*SIn(x*x);
x:=x+eps2;
iteracii2:=iteracii2+1;
end;
writeln('eps1 = 0.00001');
write('Znachenie X '); writeln(x:2:2);
write('Kolichestvo Iteracii ');
writeln(iteracii2);
readln;
end.
- 11 -

- 12 -

5. . . .
. . 45
. : ,
- .
:
A

begin
i:=1,Size
i:=I,n
randomize
k:=k+1;
k]:=a[i]

a[i]>0

i:=1,Size

true

False
j:=j,m

n:=n+1;
a[n]:=a[i]
a[i]:=random(9)-3

k:=k+1;
c[k]:=b[j]

i:=I,Size
b:=a
m:=0
k:=0; i:=1;
j:=1;

c[i]

i:=1,Size
(i<=n)and(j<
=m)

End
b[i]<0

true

if a[i]>b[j]

False

k:=k+1;
c[k]:=b[j];
j:=j+1

true

m:=m+1;
b[m]:=b[i]

k:=k+1;
c[k]:=a[i];
i:=i+1

n:=0;

False

- 13 -

5:
{
;---------------------------------------------------------------------; Program Name: theme5a from variant22
; Program Description:
; : , , .
; Program Status: It Working :)
; Author: Rodin Andrey
; Date Created: 02.12.2007
; Last Modification Date: 31.01.2008
;---------------------------------------------------------------------}
program theme5a;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
Size=45;

type
mass = array [0..Size] of integer;
var
a,b,c:mass;
i,j,k,m,n:integer;
chose:char;
label
repeate;
begin
repeate:

writeln('******************************************************************');
writeln('NOW WE HAVE A RANDOMIZER ARRAY');
randomize;
for i:=1 to Size do
begin
a[i]:=random(9)-3;
write (a[i]); write (' ');
end;
writeln;
writeln('******************************************************************');
//
writeln;
b:=a;
m:=0;
for i:=1 to Size do
begin
if b[i]<0 then
begin
m:=m+1;
- 14 -

b[m]:=b[i]
end;
end;
//
n:=0;
for i:=1 to Size do
begin
if a[i]>0 then
begin
n:=n+1;
a[n]:=a[i]
end;
end;
//
writeln(' ');
writeln('NEW ARRAY OF UNSIGNED DATA');
for i:=1 to n do
begin
write (a[i]); write (' ');
end;

writeln(''); writeln('');writeln('');
writeln('NEW ARRAY OF SIGNED DATA');
for i:=1 to m do
begin
write (b[i]); write (' ');
end;
// 2 1
k:=0; i:=1; j:=1;
while (i<=n)and(j<=m)do
if a[i]>b[j] then
begin
k:=k+1;
c[k]:=a[i];
i:=i+1
end
else
begin
k:=k+1;
c[k]:=b[j];
j:=j+1
end;
for i:=i to n do
begin
k:=k+1;
c[k]:=a[i]
end;
for j:=j to m do
begin
k:=k+1;
c[k]:=b[j]
end;
//
writeln(''); writeln('');writeln('');
writeln('RESULT :) I''m HAPPY !!!');
- 15 -

for i:=1 to Size do


begin
write (c[i]); write (' ');
end;
writeln;
writeln('******************************************************************');
writeln; writeln;
write (' ');write (' ');write (' ');
writeln('---> PRESS "R" to REPEATE or ANY KEY to EXIT <---');
readln(chose);
if (chose = 'R') or (chose = 'r') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.

- 16 -

5. . . .
. , / .
N*N, - *.
.

begin

i:=1 to
size

for i := 0
to size

for j:=1
to size

for j := 0
to size

write (a[i,j])

true

if i=j

a[i,j]:='*';
End

for i := 0
to size

n:= (size+1) - i;

for j
:=size
downto 0

true

if n=j

a[i,j]:='*';

- 17 -

{
;---------------------------------------------------------------------; Program Name: theme5a from variant22
; Program Description: ,
; / . N*N,
; - *. -
; .
; Program Status: Working :)
; Author: Rodin Andrey
; Date Created: 15.05.2008
; Last Modification Date: 15.05.2008
;---------------------------------------------------------------------}
program theme5b;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
size = 17;
type
mass = array [1..size,1..size] of char;
var
a:mass;
n:integer;
i,j:integer;
begin
writeln;
writeln('--------------------');
writeln('--PRINT NEW ARRAY---');
writeln('--------------------');
writeln('');
for i := 0 to size do
for j := 0 to size do
begin
if i=j then
a[i,j]:='*';
end;
for i := 0 to size do
begin
n:= (size+1) - i;
for j :=size downto 0 do
begin
if n=j then
a[i,j]:='*';
end;
end;
- 18 -

for i:=1 to size do begin


for j:=1 to size do write (a[i,j]);
writeln;
end;
readln;
end.

6. .
. 10 . 10
, .
: -
- .
.

- 19 -

- 20 -

{
;---------------------------------------------------------------------; Program Name: theme6 from variant22
;
;
;
;
;
;

Program Description: "". 10 .


10 ,
.
: -
- .
.

; Author: Rodin Andrey


; Date Created: 26.01.2008
; Program Status: IT Working
; Last Modification Date: 04.02.2008
;---------------------------------------------------------------------}
program theme6;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
QuestionRight: array [1..4] of String = (
'Absolutno Pravilno',
'Prabilno no Otvet Nepolny',
'Chasticno Pravilno',
'Pravilno'
);
QuestionLeft: array [1..4] of String = (
'Otvet Nevernij Sovsem',
'Glupij Otvet' ,
'Otvet Soderzhit Oshibki',
'Otvet Nevernij'
);
var
i,f,l:integer;
x:string[25];
counter:integer;
a:array [1..2] of String;
chose:char;
Question:
'Question
'Question
'Question
'Question
'Question
'Question
'Question
'Question
'Question
'Question
);

array [1..10]
1',
2',
3',
4',
5',
6',
7',
8',
9',
10'

of String = (

label
repeate;
begin
repeate:
- 21 -

randomize;
counter:=(random(20)+5);
randomize;
repeat
i:=1;
f:=(random(10)+1);
l:=(random(10)+1);
a[i]:= Question[f] ;

Question[f]:= Question[l];
Question[l]:=a[i];
counter:=counter-1;
until (counter <=0);
writeln ; writeln ;
for i:=1 to 10 do begin
write (Question[i]); writeln;
end;
writeln('******************************************************************');
writeln;
for i:=1 to 10 do

begin

writeln ; writeln ;
write (Question[i]);
readln (x);

write (' '); write (' '); write ('---> ');

write (' ');

if x='true' then
Write (QuestionRight[(random(4)+1)])
else
Write (QuestionLeft[(random(4)+1)]);

end;
writeln;
writeln;
writeln('******************************************************************');
writeln;writeln;
write (' ');write (' ');write (' ');
writeln('---> PRESS "R" to REPEATE or ANY KEY to EXIT <---');
readln(chose);
if (chose = 'R') or (chose = 'r') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.

- 22 -

- 23 -

. 7. .
S(6,6). ,
.
A
begin
j:=1,Size
randomize;
equal:=1;

I:=1,Size

i:=1,Size

n:=1;

j:=1,Size

i:=0,Size-1

a[i,j]:=char(random(9)+33);

((a[i,j] =
a[i+n,j]) and
(i+n<=size)
I:=1,Size

true
equal:=equal+1;

False
j:=1,Size

n:=n+1;

write
(a[i,j])

equal >= 2

True

COLUMN {j}
HAVE >= 2
EQUAL CHAR
A

End

{
;---------------------------------------------------------------------; Program Name: theme7 from variant22
; Program Description: S(6,6).
; ,
; .
;
;
;
;

Program Status: 04.02.2008 IT Working :)


Author: Rodin Andrey
Date Created: 02.02.2008
Last Modification Date: 05.05.2008
- 24 -

;---------------------------------------------------------------------}
program theme7;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
size = 6;
type
mass = array [1..size,1..size] of char;
var
chose:char;
a:mass;
i,j:integer;
k,l,m,n:integer;
equal:integer;
label
repeate;
begin
repeate:
writeln;
writeln('----------------------------------------------------');
writeln('----------------------------------------------------');
writeln('------------ WE HAVE ARRAY 6*6 of Char -------------');
writeln('----------------------------------------------------');
writeln('----------------------------------------------------');
writeln; writeln;
randomize;
for i:=1 to size do
for j:=1 to size do
a[i,j]:=char(random(9)+33);
for i:=1 to size do begin
write (' ');write (' ');write (' ');
for j:=1 to size do begin
write (' ');write (' '); write (a[i,j]);
write (' '); write (' ');
end;
writeln; writeln;
end;
writeln;
writeln('----------------------------------------------------');
writeln('----------------------------------------------------');
writeln('--- NOW RESULT WHERE COLUMN HAVE >= 2 EQUAL CHAR --');
writeln('----------------------------------------------------');
writeln('----------------------------------------------------');
writeln(' ');

- 25 -

for j:=1 to size do begin


for i:=1 to size do begin

equal:=1;

n:=1;
for l := 0 to size - 1 do

begin

if ((a[i,j] = a[i+n,j]) and (i+n<=size)) then


equal:=equal+1;

begin

end;
n:=n+1;
end;

end;

if equal >= 2 then begin


writeln;
write('COLUMN '); write(j); write('
end;

HAVE

writeln; writeln;
end;

writeln; writeln;
writeln; writeln;
//Repeate this Program
write(' '); write(' ');write(' '); write('>>>>>> ');
write('PRESS R to REPEATE or ANY KEY to EXIT');
write(' '); write(' ');write(' '); write('<<<<<<< ');
writeln (' ');
readln(chose);
if (chose = 'R') or (chose = 'r') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.

- 26 -

>= 2 EQUAL CHAR ');

- 27 -

8. .
, .
:
, .
, .
A
begin
i:= 1, j

ZvonkieSogl := ['',
'', '', '', '',
''];

Word {i}
{a[i]}
readln(InputString);

StringLength:=Length(InputString);

k:=1;
m:=1;

i:=1;
j:=1;
n:=1;

be:=0;ve:=0;ge:=0;de:=0;dge
:=0;ze:=0;

temp:='
';
temp1:=temp;

be1:=0;ve1:=0;ge1:=0;de1:=0
;dge1:=0;ze1:=0;

i := 1,
StringLength

k := 1,j

temp:=a[k];
StringLength:=Length(temp);
InputString[i]=' ') or
(InputString[i] = '!'

true

false

a[j]:=temp;
j:=j+1;
n:=1;
temp:=temp1;

temp[n]:= InputString[i];
n:=n+1;

j:=j-1;

- 28 -

C
B

k := 1,j

i:= 1, j

Word {i}
{a[i]}

temp:=a[k];
StringLength:=Length(temp);

m:= 1,
StringLength

if temp[m] in ZvonkieSogl

true

k:=1;
m:=1;

((temp[m]='')and (be=0))

be:=0;ve:=0;ge:=0;de:=0;dge
:=0;ze:=0;
be1:=0;ve1:=0;ge1:=0;de1:=0
;dge1:=0;ze1:=0;

true
be:=be+1;

false
((temp[m]='') and (ve=0))

true
ve:=ve+1;

false
((temp[m]='') and (ge=0))

true
ge:=ge+1;

false
((temp[m]='') and (de=0))

true
de:=de+1;

false
((temp[m]='') and (dge=0))

true
dge:=dge+1;

false
true

((temp[m]='') and (ze=0))

ze:=ze+1;

be1:=be1+be;ve1:=ve1+ve;ge1:=ge1+ge;de
1:=de1+de;dge1:=dge1+dge;ze1:=ze1+ze;
be:=0;ve:=0;ge:=0;de:=0;dge:=0;ze:=0;

Result
D

- 29 -

- 30 -

{
;---------------------------------------------------------------------; Program Name: theme8 from variant22
; Program Description: , .
; :
; , .
; ,
.
; Author: Rodin Andrey
; Program Status: ItWorking
; Date Created: 07.05.2008
; Last Modification Date: 07.05.2008
;---------------------------------------------------------------------}
program theme81;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
size = 10;
type
RussianWord = set of ' '..'';
mass = array [1..size] of string;
var
chose:char;
InputString:string;
temp,temp1:string[10];
be,ve,ge,de,dge,ze:integer;
be1,ve1,ge1,de1,dge1,ze1:integer;
StringLength:integer;
ZvonkieSogl : RussianWord;
a:mass;
i,j:integer;
k,l,m,n:integer;
equal:integer;
label
repeate;
begin
repeate:
ZvonkieSogl := ['', '', '', '', '', ''];
writeln;
writeln('----------------------------------------------------');
writeln('----------------------------------------------------');
writeln('------------ - - ---------------------');
writeln('---------- "", "", "", "","", "" ------------');
writeln('----------------------------------------------------');
writeln; writeln;
writeln;
writeln('----------------------------------------------------');
- 31 -

writeln('----------------------------------------------------');
writeln('------------ PLEASE TYPE ANY WORD ------------------');
writeln('----------------------------------------------------');
writeln('----------------------------------------------------');
writeln; writeln;
readln(InputString);
Writeln('YOU TYPED ');
Writeln(InputString);

Writeln;

StringLength:=Length(InputString);
i:=1;
j:=1;
n:=1;

// . , ..
temp:='
';
temp1:=temp;
//

for i := 1 to StringLength do

begin

if (InputString[i]=' ') or (InputString[i] = '!')

then

begin

a[j]:=temp;
j:=j+1;
n:=1;
temp:=temp1;
end;
temp[n]:= InputString[i];
n:=n+1;
end;
j:=j-1;
writeln;writeln;writeln;
for i := 1 to j do begin
write (' Word ') ; write (i) ; write (' ') ;
write (a[i]) ;
writeln;
end;
k:=1;
m:=1;
be:=0;ve:=0;ge:=0;de:=0;dge:=0;ze:=0;
be1:=0;ve1:=0;ge1:=0;de1:=0;dge1:=0;ze1:=0;
for k := 1 to j do begin
temp:=a[k];
StringLength:=Length(temp);
for m := 1 to StringLength do
begin
//
- 32 -

if temp[m] in ZvonkieSogl then


begin
if ((temp[m]='') and (be=0)) then
be:=be+1;
if ((temp[m]='') and (ve=0))then
ve:=ve+1;
if ((temp[m]='') and (ge=0)) then
ge:=ge+1;
if ((temp[m]='') and (de=0)) then
de:=de+1;
if ((temp[m]='') and (dge=0))then
dge:=dge+1;
if ((temp[m]='') and (ze=0)) then
ze:=ze+1;
end;
end;
be1:=be1+be;ve1:=ve1+ve;ge1:=ge1+ge;de1:=de1+de;dge1:=dge1+dge;ze1:=ze1+ze;
be:=0;ve:=0;ge:=0;de:=0;dge:=0;ze:=0;
end;
writeln;
writeln('----------------------------------------------------');
writeln('----------------------------------------------------');
writeln('---------------------- ------------------');
writeln('----------------------------------------------------');
writeln('----------------------------------------------------');
writeln(' ');
// 2
if be1>=2 then
begin
write(' '); write(' '); write(''); write(' '); write(' ');
end;
if ve1>=2 then
begin
write(' '); write(' '); write(''); write(' '); write(' ');
end;
if ge1>=2 then
begin
write(' '); write(' '); write(''); write(' '); write(' ');
end;
if de1>=2 then
begin
write(' '); write(' '); write(''); write(' '); write(' ');
end;
if dge1>=2 then
begin
write(' '); write(' '); write(''); write(' '); write(' ');
end;
- 33 -

if ze1>=2 then
begin
write(' '); write(' '); write(''); write(' '); write(' ');
end;

writeln; writeln;
writeln; writeln;
//Repeate this Program
write(' '); write(' ');write(' '); write('>>>>>> ');
write('PRESS R to REPEATE or ANY KEY to EXIT');
write(' '); write(' ');write(' '); write('<<<<<<< ');
writeln (' ');
readln(chose);
if (chose = 'R') or (chose = 'r') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.

- 34 -

9. . Delphi.
, . .
:
4) ;
5) ;
6) .
N*M. ,
.

A
begin
I:=1,rows
randomize;
Minimalniy Element {n}
Stroki
{MinColsResult(n)}
I:=1,rows

n:=n+1
countet:=rows;

j:=1,cols

Repeat
countet =
0

a[i,j]:=random(9);

n:=1;
I:=1,rows
I:=1,rows
j:=1,cols

(((MinColsResult(n) >
MinColsResult(n+1)) and
(n+1 <= rows)))

a[i,j]

true

fasle

b[i]:= a[i+1];
a[i+1]:= a[i];
a[i]:= b[i];

n:=1;

n:=n+1
countet:= countet-1;

n:=1

- 35 -

Begin
MinColsResult

k:=10;
I:=1,rows
j:=1,cols
Minimalniy Element {n}
Stroki
{MinColsResult(n)}

false

a[n,j] < k

true

n:=n+1

k:=a[n,j];
MinColsResult:=k

I:=1,rows

End

j:=1,cols

a[i,j]

End

{
;---------------------------------------------------------------------; Program Name: theme9 from variant22
; Program Description: N*M.
; ,
; .
; Program Status: IT Working :) 03.02.2008
; Author: Rodin Andrey
; Date Created: 02.02.2008
; Last Modification Date: 07.02.2008
;---------------------------------------------------------------------}
program theme9;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
rows = 15;
- 36 -

cols = 10;
type
mass = array [1..rows,1..cols] of integer;
var
chose:char;
a,b:mass;
i,j:integer;
k,n,m,countet:integer;
function MinColsResult (n: integer): integer;
begin {MinColsResult}
k:=10;
for j:=1 to cols do
begin
if a[n,j] < k then
k:=a[n,j];
end;
MinColsResult:=k;
end {MinColsResult};
label
repeate;
begin
repeate:
writeln;

writeln;

writeln('---------------------');
writeln('--WE HAVE ARRAY N*M--');
writeln('---------------------');
writeln;
randomize;
for i:=1 to rows do
for j:=1 to cols do
a[i,j]:=random(9);
for i:=1 to rows do begin
for j:=1 to cols do begin
write (a[i,j]); write (' ');
end;
writeln;
end;
writeln; writeln;
writeln('----------------------------------------');
writeln('--Paspechataem Minimalnie Elementi -----');
writeln('----------------------------------------');
writeln;
n:=1;
for i:=1 to rows do begin
write(' Minimalniy Element '); write(n);
writeln(MinColsResult(n));
n:=n+1
end;

write (' Stroki - ');

- 37 -

countet:=rows;
repeat
n:=1;
for i:=1 to rows do begin
if (((MinColsResult(n) > MinColsResult(n+1)) and (n+1 <= rows))) then begin
b[i]:= a[i+1];
a[i+1]:= a[i];
a[i]:= b[i];
end;
n:=n+1;
end;
countet:= countet-1;
until countet = 0;
writeln;writeln;writeln;
//

writeln('----------------------------------------');
writeln('------------ Sorting Rows -------------');
writeln('----------------------------------------');
writeln;
n:=1;
for i:=1 to rows do begin
write(' Minimalniy Element '); write(n); write (' Stroki - ');
writeln(MinColsResult(n));
n:=n+1
end;
writeln;writeln;
//

writeln('----------------------------------------');
writeln('---------------Result-------------------');
writeln('----------------------------------------');
writeln;
for i:=1 to rows do begin
for j:=1 to cols do begin
write (a[i,j]); write (' ');
end;
writeln;
end;
writeln; writeln;
//Repeate this Program
writeln('PRESS R to REPEATE or ANY KEY to EXIT');
readln(chose);
if (chose = 'R') or (chose = 'r') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.
- 38 -

- 39 -

- 40 -

10. . . .
, .
.
1. - KOR
f(x)=0 c 0.1
-x2+sin(x/2)=1
5
3
x +3x +x2+1=0
Begin
Uravnenie1

begin

Max Otricatelniy Koren


Uravneniya -x2+sin(x/2)=1

while (-(x*x)+Sin(x/2)-1)<>0

Uravnenie1(-0.1):0:2)

(-(x*x)+Sin(x/2)1) < 0.1

true

End
Break

false

x:=x-0.1;
x:=round(x*10)/10;

End

Listing theme10a.dpr
{
;---------------------------------------------------------------------; Program Name: theme10a from variant22
; Program Description: - KOR
; f(x)=0 c 0.1
;
; -x2+sin(x/2)=1 x5+3x3+x2+1=0
; Program Status: Not Working :)
; Author: Rodin Andrey
; Date Created: 23.05.2008
; Last Modification Date: 23.05.2008
;---------------------------------------------------------------------}
program theme10a;
- 41 -

{$APPTYPE CONSOLE}
uses
SysUtils,
Module_theme10a in 'Module_theme10a.pas';
begin
Writeln('Max
Otricatelniy
Writeln(Uravnenie1(-0.1):0:2);
Writeln;Writeln;
Writeln('Max
Otricatelniy
Write(Uravnenie2(-0.1):0:2);
readln;
end.

Koren
Koren

Uravneniya

-x2+sin(x/2)=1

');

x5+3x3+x2+1=0

');

Uravneniya

Listing

Module_theme10a.pas

// *************************************************************************
Unit Module_theme10a;
*****************************************************************************
{---------------------------------------------------------------------}
Interface
{---------------------------------------------------------------------}
function
function

Uravnenie1 (x:real):real;
Uravnenie2 (x:real):real;

{---------------------------------------------------------------------}
Implementation
{---------------------------------------------------------------------}
function

Uravnenie1 (x:real):real;

begin
while (-(x*x)+Sin(x/2)-1)<>0 do
begin
if (-(x*x)+Sin(x/2)-1) < 0.1 then Break;
x:=x-0.1;
x:=round(x*10)/10;
end;
Uravnenie1:=x;
end;
function

Uravnenie2 (x:real):real;

begin
while (x*x*x*x*x+3*(x*x*x)+x*x+1) <>0 do
begin

if (x*x*x*x*x+3*(x*x*x)+x*x+1) < 0.1 then Break;

x:=x-0.1;
x:=round(x*10)/10;
end;
Uravnenie2:=x;
end;
End.
- 42 -

Result

- 43 -

10. . . .
2. ,
N*N, , .
. .
begin

for i:=1 to N

for j:=1 to N

a[i,j]:=random(9);

for i:=1 to N

for j:=1 to N

(a[i,j])

(a[i,j])

Unicum ;

End

- 44 -

Begin
Unicum

A
for i := 1 to q -1

q:=1;
b[i])
for i:=1 to N

x:=1;
for j:=1 to N

for i := 1 to q -1
i+j>N+1
b[q]:=a[i,j];
q:=q+1;

b[i] <> b[i+1]

d[x]:= b[i];
x:=x+1;
for i := 1 to q -1
b[i]
b[i]

UNICUM (x-1)
ELEMTNTA
counter:=q*(q-1);
End
Unicum
Repeat
Until counter=0

for I := 1 to q - 1

((b[i]>=
b[i+1]) and
(i+1<=q-1))
d[i]:=b[i];
b[i]:=b[i+1];
b[i+1]:=d[i];

counter:=

counter - 1;
A

- 45 -

Listing theme10b.dpr
{
;---------------------------------------------------------------------; Program Name: theme10b from variant22
; Program Description: ,
; N*N,
; , .
; . .
; Program Status: IT Working :)
; Author: Rodin Andrey
; Date Created: 08.02.2008
; Last Modification Date: 08.02.2008
;---------------------------------------------------------------------}
program theme10b;
{$APPTYPE CONSOLE}
uses
SysUtils;
const
N = 6;
M = n*n;
type
mass = array [1..N,1..N] of integer;
mass2 = array [1..M] of integer;
var
chose:char;
counter:integer;
a:mass;
b,c,d:mass2;
i,j,q,l,s,x:integer;
procedure Unicum ;
begin {Unicum}
q:=1;
for i := 1 to N do begin
for j := 1 to n do
begin
if i+j>N+1 then begin
b[q]:=a[i,j];
q:=q+1;
end;
end;
end;
writeln; writeln;
for i := 1 to q -1 do begin
write(' '); write( b[i]);
write(' ');
end;
- 46 -

writeln;
writeln;
writeln('-----------------------------------------------------');
writeln('------------------ Sorting --------------------------');
writeln;
counter:=q*(q-1);
repeat

for I := 1 to q - 1 do

begin

if ((b[i]>= b[i+1]) and (i+1<=q-1))then


d[i]:=b[i];
b[i]:=b[i+1];
b[i+1]:=d[i];
end;

begin

end;
counter:=

counter - 1;

until counter=0 ;
for i := 1 to q -1 do begin
write(' '); write( b[i]); write(' ');
end;
writeln;
writeln;
writeln('-----------------------------------------------------');
writeln('------------------ UNICALNIE ------------------------');
writeln;
x:=1;
for i := 1 to q -1 do begin
if b[i] <> b[i+1] then
begin
write (' ');
d[x]:= b[i];
x:=x+1;
write (b[i]); write (' ');
end;
end;
writeln; writeln;writeln;
write ('UNICUM '); write (x-1);

write (' ELEMTNTA ');

end; {Unicum}

label
repeate;
- 47 -

begin
repeate:
writeln;

writeln;

writeln('---------------------');
writeln('--WE HAVE ARRAY N*M--');
writeln('---------------------');
writeln;
randomize;
for i:=1 to N do
for j:=1 to N do
a[i,j]:=random(9);
for i:=1 to N do begin
for j:=1 to N do begin
write (a[i,j]); write (' ');
end;
writeln;
end;
writeln; writeln;

writeln('-----------------------------------------------------');
writeln('-------------- Pod Pobochnoj ------------------------');
writeln('---------------- Diagonalju -------------------------');
writeln;
Unicum ;
writeln; writeln;
writeln('PRESS R to REPEATE or ANY KEY to EXIT');
readln(chose);
if (chose = 'R') or (chose = 'r') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.

- 48 -

- 49 -

11. .
, ().
, :
+++++++++
(9 )
----------(11 )
.
.
.
+++++++ . . . . . . . . .++++++
(21 )
-------. . . . . . ----(19 )
.
.
.
+++++++++
(9 )

11
{
;---------------------------------------------------------------------; Program Name: 11.
; Program Description: , ().
; , :
; Program Status: ItWorking
; Author: Rodin Andrey
; Date Created: 16.05.2008
; Last Modification Date: 16.05.2008
;---------------------------------------------------------------------}
program theme11;
{$APPTYPE CONSOLE}
uses
SysUtils;
procedure ReCursia(Character: char; Length: integer);
Begin {ReCursia}
if Length-1>=0 then
- 50 -

begin
write(character);
Length:=Length-1;
ReCursia(Character , Length);
end;
End;

{ReCursia}

begin
writeln; writeln;
ReCursia(' ' , 9);
ReCursia('+' , 9);
writeln; writeln;
ReCursia(' ' , 8);
ReCursia('-' , 11);
writeln; writeln;
ReCursia(' ' , 9);
ReCursia('.' , 1);
ReCursia(' ' , 3);
ReCursia('.' , 1);
ReCursia(' ' , 3);
ReCursia('.' , 1);
writeln; writeln;
ReCursia(' ' , 4);
ReCursia('+' , 5); ReCursia('.' , 9); ReCursia('+' , 5);
writeln; writeln;
ReCursia(' ' , 5);
ReCursia('-' , 5); ReCursia('.' , 9); ReCursia('-' , 5);
writeln; writeln;
ReCursia(' ' , 9);
ReCursia('.' , 1);
ReCursia(' ' , 3);
ReCursia('.' , 1);
ReCursia(' ' , 3);
ReCursia('.' , 1);
writeln; writeln;
ReCursia(' ' , 9);
ReCursia('+' , 9);

readln;
end.

- 51 -

- 52 -

12. . .
x1, x2, x3... xn n>2.
, ,
.
:
A
begin
You Are Typed
ZERO
NOW RESULT

Head := Nil

Digit

while
First <>
Nil

if Digit <> 0

First^.Data, ' '

true
First := First^.tpel;

x^.tpel := Nil;
x^.Data := Digit;
First := x ;

false

Digit
End

while
Digit<>0

if Digit > 0

true

false

New(x^.tpel);
x := x^.tpel;
x^.tpel := Nil;
x^.Data := Digit;

New(Pre);
Pre^.Data := Digit;
Pre^.tpel := First;
First := Pre;

Read(Digit);

- 53 -

:
{
;---------------------------------------------------------------------; Program Name: 12. . .
; Program Description:
; x1, x2, x3... xn n>2. ,
; , .

; Program Status: Working :) 10.02.2008


; Author: Rodin Andrey
; Date Created: 10.02.2008
; Last Modification Date: 10.02.2008
;---------------------------------------------------------------------}
program theme12copy;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
index = ^element;
element=record
Data:integer;
tpel:index;
end;
var
digit: integer;
chose: char;
Head, { }
x, y,
First,Pre,Next,Last
{ }
: index;
label
repeate;
begin
repeate:
//
writeln('----------------------------------------------------');
writeln('------------------- PLEASE -------------------------');
writeln('----------- TYPE ANY NUMERIC DATA ------------------');
Writeln ('---- IF You Typed Zero Program well be Closed ----');
Head := Nil;
read(Digit);
- 54 -

if Digit <> 0
then { }
Begin
New(x);
x^.tpel := Nil;
x^.Data := Digit;
First := x ;
Read (Digit);
End;
while Digit<>0 do
Begin
if Digit>0 then begin
New(x^.tpel); { }
x := x^.tpel;
x^.tpel := Nil;
x^.Data := Digit;
end;
if Digit < 0 then begin
New(Pre);
Pre^.Data := Digit;
Pre^.tpel := First;
First := Pre;
end;
Read(Digit);
End;
writeln; writeln;
writeln('You Are Typed ZERO');
writeln('----------------------------------------------------');
writeln('NOW RESULT');
while First <> Nil do
Begin
Write(First^.Data, ' ');
First := First^.tpel;
End ;
writeln; writeln;
//Repeate this Program
writeln('PRESS R to REPEATE or ANY KEY to EXIT');
readln(chose);
if (chose = 'R') or (chose = 'r') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.
- 55 -

- 56 -

13. .
F, . ,
. G .
:
Begin
AddNewRecord

begin

i:=0;
Assign (FBooks, 'f.txt');
Assign (GBooks, 'g.txt');

'Input Book Name'

Books[i].BookName
- Please Type What You Want - 1 - Insert --------------- 2 - Read ----------------- 3 - Write ---------------- 4 - Sea Result -----------

'Input Book Author'

Books[i].Author
x
'Input Year'
case x of
Books[i].Year
Begin
AddNewRecord
reset(FBooks);
Seek (FBooks, FileSize(Fbooks))
Write(FBooks, Books[i]);
Close(FBooks);

Begin
ReadRecord
Begin
WriteRecord
Begin
SeaResultRecord

End
AddNewRecord

You May Only


type 1,2,3,4'

End

- 57 -

Begin
ReadRecord

reset(FBooks);
Seek (FBooks, 0);

while not
Eof(Fbooks)

read (FBooks, Books[i]);

false

IOResult <> 0

true

'FileRecord Was
Not be Read'

write (Books[i].BookName);
write (Books[i].Author)
write (Books[i].Year);

i:=i+1 ;

Close(FBooks);

End
ReadRecord

- 58 -

Begin
WriteRecord
reset(FBooks);
Seek (FBooks, 0);
reset(GBooks);
Seek (GBooks, 0);
rewrite(GBooks);
m:=1;

while not
Eof(Fbooks)

read (FBooks, Books[i]);

IOResult <> 0

false

tempword1:= Books[i].BookName;
x:=length(tempword1);

for k := x
downto 1

tempword2:= copy (tempword1,k,1);


tempword3:= tempword3 + tempword2;

NewBooks[m].NewName:=tempword3;
Seek (GBooks, FileSize(GBooks));
Write(GBooks, NewBooks[m]);
tempword3:='';
i:=i+1;
m:=m+1;

Close(FBooks);
Close(GBooks);

End
WriteRecord

- 59 -

true

'FileRecord Was
Not be Read'

{
;---------------------------------------------------------------------; Program Name: . theme13 from variant22
; Program Description: F, .
; , .
; G .
; Program Status: Working :) 24.02.2008
; Author: Rodin Andrey
; Date Created: 02.02.2008
; Last Modification Date: 05.05.2008
;---------------------------------------------------------------------}
program theme13;
{$APPTYPE CONSOLE}
type
Organizer = record
BookName: String[60];
- 60 -

Author: String[20];
Year: Integer;
end;
NewOrganizer = record
NewName: String[60];
end;
const
MAXRecord=100;
var
Books: array[1..MAXRecord] of Organizer;
NewBooks: array[1..MAXRecord] of NewOrganizer;
FBooks: file of Organizer;
GBooks: file of NewOrganizer;
FileRecords: Organizer;
chose:char;
i,x,k,m:integer;
tempword1, tempword2, tempword3:String[60];
procedure AddNewRecord ;
begin {AddNewRecord}
writeln('Input Book Name');
Readln(Books[i].BookName);
writeln('Input Book Author');
readLn(Books[i].Author);
writeln('Input Year');
readLn(Books[i].Year);
reset(FBooks);
Seek (FBooks, FileSize(FBooks));

//

{$S-}
Write(FBooks, Books[i]);
{$S+}
writeln;writeln;writeln;writeln;writeln;writeln;
if IOResult <> 0 then
writeln ('FileRecord Was Not be Writen')
else
writeln ('Next Data Seccesefull Writen');
writeln;writeln;
write
write
write

('Name -->');
('Author -->');
('Year -->');

write
write
write

(Books[i].BookName);
writeln;
(Books[i].Author); writeln;
(Books[i].Year);
writeln;

Close(FBooks);
end {AddNewRecord};
procedure ReadRecord ;
begin {ReadRecord}
reset(FBooks);
Seek (FBooks, 0);
while not Eof(FBooks) do
begin
- 61 -

{$S-}
read (FBooks, Books[i]);
{$S+}
if IOResult <> 0 then
writeln ('FileRecord Was Not be Read')
else
writeln ;
write ('------------------------');
writeln ;
write
write
write
write

(i);
write (')');
(Books[i].BookName);
(Books[i].Author);
(Books[i].Year);

write
write
write
write

('
('
('
('

');
');
');
');

i:=i+1 ;
end;
readln(chose);
Close(FBooks);
end {ReadRecord};
procedure WriteRecord (k,x:integer);
begin {WriteRecord}
reset(FBooks);
Seek (FBooks, 0);
reset(GBooks);
Seek (GBooks, 0);
rewrite(GBooks);
m:=1;
while not Eof(FBooks) do
begin
{$S-}
read (FBooks, Books[i]);
{$S+}
if IOResult <> 0 then
writeln ('FileRecord Was Not be Read')
else
tempword1:= Books[i].BookName;
x:=length(tempword1);
for k := x downto 1 do
begin
tempword2:= copy (tempword1,k,1);
tempword3:= tempword3 + tempword2;
end;
writeln ;
write ('------------------------');
writeln ;
write (i);
write (')');
write (' ');
write (tempword3);
write (' ');
NewBooks[m].NewName:=tempword3;
- 62 -

Seek (GBooks, FileSize(GBooks));

//

{$S-}
Write(GBooks, NewBooks[m]);
{$S+}

tempword3:='';
i:=i+1;
m:=m+1;
end;
readln(chose);
Close(FBooks);
Close(GBooks);
end {WriteRecord};
procedure SeaResultRecord ;
begin {SeaResultRecord}
reset(GBooks);
Seek (GBooks, 0);
i:=1;
while not Eof(GBooks) do
begin
{$S-}
read (GBooks, NewBooks[i]);
{$S+}
if IOResult <> 0 then
writeln ('FileRecord Was Not be Read')
else
writeln ;
write ('------------------------');
writeln ;
write (i);
write (')');
write (NewBooks[i].NewName);
write (' ');

write (' ');


write (' ');

i:=i+1 ;
end;
readln(chose);
Close(GBooks);
end {SeaResultRecord};
label
repeate;
begin
repeate:
i:=0;
- 63 -

Assign (FBooks, 'f.txt');


Assign (GBooks, 'g.txt');
writeln('-----------------------------------------------');
writeln('------------------- You May -------------------');
writeln('----- Insert, Delete, Write or Sea Record -----');
writeln('-----------------------------------------------');
writeln;
writeln('--------- Please Type What You Want -----------');
writeln('---------- 1 - Insert ------------------------');
writeln('---------- 2 - Read --------------------------');
writeln('---------- 3 - Write -------------------------');
writeln('---------- 4 - Sea Result --------------------');
Readln(x);
case x of
1:
2:
3:
4:

AddNewRecord ;
ReadRecord;
WriteRecord(0,0);
SeaResultRecord ;

else
writeln(' You May Only type 1,2,3,4');
end;
writeln; writeln;
writeln('PRESS R to REPEATE or ANY KEY to EXIT');
readln(chose);
if (chose = 'R') or (chose = 'r') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.

- 64 -

14. .
, . ,
, .
- . : . : ,
. ,
. ( ).

- 65 -

A
begin

MaxCostbyMeter >=
Room1.CostbyMeter

myCost:=0;
myArea:=0;

readln(myCost);
readln(myArea);

(Room1.Cost, Room1.Area,
Room1.CostbyMeter)

Room1.CreateObject(myCost,
myArea);

k:=1;

false

printResult (Room1.Cost,
Room1.Area,
Room1.CostbyMeter);

MaxCostbyMeter >=
Room2.CostbyMeter

readln(myCost);
readln(myArea);

(Room2.Cost, Room1.Area,
Room2.CostbyMeter)

Room2.CreateObject(myCost,
myArea);

k:=1;

printResult (Room2.Cost,
Room2.Area,
Room2.CostbyMeter);

readln(myCost);
readln(myArea);

true

MaxCostbyMeter >=
Room3.CostbyMeter
A
(Room3.Cost, Room1.Area,
Room3.CostbyMeter)

Room2.CreateObject(myCost,
myArea);

k:=1;

printResult (Room2.Cost,
Room2.Area,
Room2.CostbyMeter);
k=0
writeln(' Please Type
Maximum Cost by meter --->');
Sorry ... :
MaxCostby
Meter;

K:=0;

End

- 66 -

Begin
TmyRoom.priceByMeter
CostbyMeter:=eCost
/eArea;

End
TmyRoom.priceByMeter

Begin
TmyRoom.CreateObject

Begin
printResult

Cost:=eCost;
Area:=eArea;
priceByMeter(Cost,Area);

Cost;
Area;
CostbyMeter;

End
TmyRoom.CreateObject

End
printResult

Listing theme14.dpr
{
;---------------------------------------------------------------------; Program Name: . theme14 from variant22
; Program Description: , .
; ,
; , .
; - . : .
; : , .
; ,
; . ( ).
; Program Status: NotWorking :) 12.05.2008
; Author: Rodin Andrey
; Date Created: 02.02.2008
; Last Modification Date: 05.05.2008
;---------------------------------------------------------------------}
program theme14;
{$APPTYPE CONSOLE}
uses
SysUtils,
Module_theme14a in 'Module_theme14a.pas',
Module_theme14b in 'Module_theme14b.pas';
var
chose:char;
i,k:integer;
myCost,myArea,MaxCostbyMeter:real;
Room1,Room2,Room3: TmyRoom;
label
repeate;
begin
repeate:
myCost:=0;
myArea:=0;
//
//
**
//
//

*****************************************************************************
**

**
**
**
*****************************************************************************

- 67 -

//
//
//
//

*****************************************************************************
**
Room1
**
**
**
*****************************************************************************
writeln(' ');
writeln(' ');
writeln(' Please Type Cost --->');
readln(myCost);
writeln(' ');
writeln(' ');
writeln(' Please Type Area --->');
readln(myArea);
writeln; writeln;

Room1.CreateObject(myCost, myArea);
writeln; writeln;
writeln; writeln;
printResult (Room1.Cost, Room1.Area, Room1.CostbyMeter);
//
//
//
//

*****************************************************************************
**
Room2
**
**
**
*****************************************************************************
writeln(' ');
writeln(' ');
writeln(' Please Type Cost --->');
readln(myCost);
writeln(' ');
writeln(' ');
writeln(' Please Type Area --->');
readln(myArea);
writeln; writeln;

Room2.CreateObject(myCost, myArea);
writeln; writeln;
writeln; writeln;
printResult (Room2.Cost, Room2.Area, Room2.CostbyMeter);

//
//
//
//

*****************************************************************************
**
Room3
**
**
**
*****************************************************************************
writeln(' ');
writeln(' ');
writeln(' Please Type Cost --->');
- 68 -

readln(myCost);
writeln(' ');
writeln(' ');
writeln(' Please Type Area --->');
readln(myArea);
writeln; writeln;

Room3.CreateObject(myCost, myArea);
writeln; writeln;
writeln; writeln;
printResult (Room3.Cost, Room3.Area, Room3.CostbyMeter);
//
//
**
//
//

*****************************************************************************
**

**
**

**
*****************************************************************************

writeln(' '); writeln(' '); writeln(' ');


writeln(' Please Type Maximum Cost by meter ---->');
readln (MaxCostbyMeter);

writeln('');

writeln(''); writeln('');

writeln('*******************************************');
K:=0;
if MaxCostbyMeter >= Room1.CostbyMeter then
begin
printResult (Room1.Cost, Room1.Area, Room1.CostbyMeter);
k:=1;
writeln;writeln;
end;
if MaxCostbyMeter >= Room2.CostbyMeter then
begin
printResult (Room2.Cost, Room2.Area, Room2.CostbyMeter);
k:=1;
writeln;writeln;
end;
if MaxCostbyMeter >= Room3.CostbyMeter then
begin
printResult (Room3.Cost, Room3.Area, Room3.CostbyMeter);
k:=1;
writeln;writeln;
end;
if k=0 then
writeln(' Sorry ... :(');
writeln('*******************************************');
- 69 -

writeln('PRESS R to REPEATE or ANY KEY to EXIT');


readln(chose);
if (chose = 'R') or (chose = 'r') then
goto repeate
else
writeln ('It''s All, ByBy !!! :)');
readln;
end.
Listing Module_theme14a.pas
// **********************************************************************
**
Unit Module_theme14a;
**
// *****************************************************************************
{---------------------------------------------------------------------------}
Interface
{---------------------------------------------------------------------------}
type

TmyRoom = object
Cost,Area:real;
CostbyMeter:real;
function priceByMeter(var eCost:real; var eArea:real):real;

end;

constructor CreateObject(var eCost:real; var eArea:real);

{---------------------------------------------------------------------------}
Implementation
{---------------------------------------------------------------------------}
// ***********************************************************************
function TmyRoom.priceByMeter(var eCost:real; var eArea:real):real;
// ************************************************************************
begin {priceByMeter}
CostbyMeter:=eCost/eArea;
end; {priceByMeter}
// ********************************************************************** //
constructor TmyRoom.CreateObject(var eCost:real; var eArea:real);
// ********************************************************************** //
begin {CreateObject}
Cost:=eCost;
Area:=eArea;
priceByMeter(Cost,Area);
end; {CreateObject}

End.
- 70 -

Listing Module_theme14a.pas
// ************************************************************************
Unit Module_theme14b;
// **************************************************************************
{------------------------------------------------------------------------}
Interface
{------------------------------------------------------------------------}

procedure printResult(Cost:real; Area:real; CostbyMeter:real);


{-------------------------------------------------------------------------}
Implementation
{-------------------------------------------------------------------------}
// *************************************************************************
procedure printResult(Cost:real; Area:real; CostbyMeter:real);
// *************************************************************************
begin {printResult}
writeln('*******************************************');
writeln('Room');
write('Cost ');
write((Cost):0:2);
write(' $');
write('
');
write('Area ');
write((Area):0:2); writeln(' m');
writeln('*******************************************');
write('Prise By Meter:

');

write((CostbyMeter):0:2);
writeln(' $/m');
writeln('*******************************************');
end; {printResult}

End.

- 71 -

- 72 -

15.

unit C_unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
ButtonReset: TButton;
ButtonEqual: TButton;
ButtonSumma: TButton;
ButtonRaznost: TButton;
ButtonProizvedenie: TButton;
ButtonDelenie: TButton;
ButtonExit: TButton;
Edit1: TEdit;
procedure ButtonSummaClick(Sender: TObject);
procedure ButtonDelenieClick(Sender: TObject);
procedure ButtonExitClick(Sender: TObject);
procedure ButtonResetClick(Sender: TObject);
procedure ButtonEqualClick(Sender: TObject);
procedure ButtonRaznostClick(Sender: TObject);
procedure ButtonProizvedenieClick(Sender: TObject);
private
{ Private declarations }
- 73 -

public
{ Public declarations }
end;
var
Form1: TForm1;
implementation

var
Sum:real;
operation:char='@';
{$R *.dfm}
procedure operate;
var

s:string;
code:integer;
n:real;

begin
s:=Form1.Edit1.text;
Form1.Edit1.clear;
val(s,n,code);

case operation of

text Edit1}
Edit1}

}
{ }

'@': sum:=n;
'+': sum:=sum+n;
'-': sum:=sum-n;
'*': sum:=sum*n;
'/': sum:=sum/n;
end;
end;
procedure TForm1.ButtonResetClick(Sender: TObject);
begin
Edit1.Clear;
operation:='@';
Edit1.SetFocus;
end;
procedure TForm1.ButtonSummaClick(Sender: TObject);
begin
operate;
operation:='+';
Edit1.SetFocus;
end;
- 74 -

procedure TForm1.ButtonEqualClick(Sender: TObject);


var s:string;
begin
operate;

{ }

str(sum:6:3,s);
Edit1.text:=s;

{ }
{ Edit1}

operation:='@';
Edit1.setfocus;

{ Button1}

end;

procedure TForm1.ButtonDelenieClick(Sender: TObject);


begin
operate;
operation:='/';
Edit1.setfocus;
end;
procedure TForm1.ButtonExitClick(Sender: TObject);
begin
Close;
end;

procedure TForm1.ButtonRaznostClick(Sender: TObject);


begin
operate; { }
operation:='-';

{ " +"}

Edit1.setfocus; { Edit1}
end;

procedure TForm1.ButtonProizvedenieClick(Sender: TObject);


begin
operate;
operation:='*';
Edit1.setfocus;
end;
end.

- 75 -


NoteBooks.dproj
program NoteBooks;
uses
Forms,
Note in 'Note.pas' {NoteBookForm},
Add in 'Add.pas' {AddNewForm},
Search in 'Search.pas' {SearchForm};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TNoteBookForm, NoteBookForm);
Application.CreateForm(TAddNewForm, AddNewForm);
Application.CreateForm(TSearchForm, SearchForm);
Application.Run;
end.

Add.pas
unit Add;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
- 76 -

TAddNewForm = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
type zap=record
fam:string[22];

{}

name:string[22];

{}

fon:string[22];

{}

adr:string[22];

{}

end;
var
AddNewForm: TAddNewForm;
f:file of zap;
z:zap;
implementation
{$R *.dfm}
procedure TAddNewForm.Button1Click(Sender: TObject);
var
size:integer;
begin
AssignFile(f,'telefon.dat');
{$I-} Reset(F); {$I+}
if ioresult=0 then
begin size := FileSize(f);
- 77 -

seek(f,size);
end
else

rewrite(f);

z.fam:=edit1.text;
z.name:=edit2.text;
z.fon:=edit3.text;
z.adr:=edit4.text;
edit1.clear;
edit2.clear;
edit3.clear;
edit4.clear;
write(f,z);
edit1.setfocus;
closefile(f);
end;

procedure TAddNewForm.Button2Click(Sender: TObject);


begin
self.hide;
end;
procedure TAddNewForm.Edit1Change(Sender: TObject);
begin
edit2.clear;
edit3.clear;
edit4.clear;
end;
end.

Note.pas
unit Note;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg;
type
- 78 -

TNoteBookForm = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
NoteBookForm: TNoteBookForm;
implementation
uses Search, Add;
{$R *.dfm}
procedure TNoteBookForm.Button1Click(Sender: TObject);
var size:integer;
begin
AddNewForm.Show;
AddNewForm.edit1.setfocus;
end;
procedure TNoteBookForm.Button2Click(Sender: TObject);
begin
SearchForm.show;
SearchForm.edit1.setfocus;
end;

procedure TNoteBookForm.Button3Click(Sender: TObject);


begin
Close;
end;
- 79 -

end.

Search.pas
unit Note;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, jpeg;
type
TNoteBookForm = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Image1: TImage;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
NoteBookForm: TNoteBookForm;
implementation
uses Search, Add;
{$R *.dfm}
procedure TNoteBookForm.Button1Click(Sender: TObject);
var size:integer;
begin
AddNewForm.Show;
AddNewForm.edit1.setfocus;
end;
- 80 -

procedure TNoteBookForm.Button2Click(Sender: TObject);


begin
SearchForm.show;
SearchForm.edit1.setfocus;
end;

procedure TNoteBookForm.Button3Click(Sender: TObject);


begin
Close;
end;
end.

- 81 -

- 82 -

16. . .
VCL.
, , ,
.
.
1. , .
2. , .
4. ,
. .
5.

- 83 -

A
while not
eof(F)

false

false

read(F,Z);

(z.DataofDelivery) >=
DataControlCheck

true

z.Quantity>=
QuantityControlCheck

true

x:=0;
StringGrid1.Cells[x,y]:=DateToStr(z.
DataofDelivery);
x:=1;
StringGrid1.Cells[x,y]:=z.NameGood;
x:=2;
str(z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
x:=3;
str(z.Prise,s);
StringGrid1.Cells[x,y]:=s;
x:=4;
str(z.Prise*z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
allCostwhatYouSee:=allCostwhatYouSee
+ z.Prise*z.Quantity;

maxCostOfParty <
z.Prise*z.Quantity

true

maxCostOfParty:=
z.Prise*z.Quantity;
lbl_maxCostotPartyName.
Caption:=z.NameGood;

false

y:=y+1;

End
TForm1.FormCreate(Sender: TObject);

- 84 -

Listing SKLAD.dproj
program SKLAD;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Listing Unit1.pas
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Grids, Menus;
type
TForm1 = class(TForm)
StringGrid1: TStringGrid;
SaveButton: TButton;
Button_Filters: TButton;
Minquantity: TEdit;
TEditDataofDelivery: TEdit;
LblMaxCost: TLabel;
Button1: TButton;
GroupBox1: TGroupBox;
Label5: TLabel;
Label3: TLabel;
GroupBox2: TGroupBox;
Label4: TLabel;
Label6: TLabel;
lbl_maxCostotPartyName: TLabel;
lblAllCost: TLabel;
LabelMaxCost: TLabel;
Label2: TLabel;
Button2: TButton;
Sbros: TButton;
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
var CanSelect: Boolean);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure
procedure
procedure
procedure

SaveButtonClick(Sender: TObject);
Button1Click(Sender: TObject);
Button_FiltersClick(Sender: TObject);
SbrosClick(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;
type DBRecord=record
DataofDelivery : TDateTime;

{ }
- 85 -

NameGood:string[50];
Quantity:integer;
Prise:integer;
Cost:integer;
end;

{ }
{- .}
{}
{ }

var
Form1: TForm1;
F:file of DBRecord;
Z:DBRecord;
dataControlCheck: TDateTime;
quantityControlCheck: integer;
maxCostOfParty: integer;
allCostwhatYouSee: integer;

// ..
// ..
//
//

SGX,SGY:integer;
filename:string[255]='MainBD.dbs';
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
var x,y,i:integer;
s:string[10];
begin
for i:=0 to 5 do begin
StringGrid1.Cells[0,i]:='';
StringGrid1.Cells[1,i]:='';
end;
form1.Caption:=' - ['+filename+']';
StringGrid1.Cells[0,0]:=' ';
StringGrid1.Cells[1,0]:=' ';
StringGrid1.Cells[2,0]:='-';
StringGrid1.Cells[3,0]:='';
StringGrid1.Cells[4,0]:=' ';
AssignFile(F,filename);
{$I-} Reset(F); {$I+}
if ioresult<>0 then begin
StringGrid1.Cells[0,1]:=' ';
end
else begin
y:=1;
dataControlCheck:=StrToDate(TEditDataofDelivery.text);
quantityControlCheck:=StrToInt(Minquantity.Text);
maxCostOfParty:=0;
allCostwhatYouSee:=0;
while not eof(F) do begin
read(F,Z);
if (z.DataofDelivery) >= DataControlCheck
begin

then

if z.Quantity>= QuantityControlCheck then


begin
x:=0;
StringGrid1.Cells[x,y]:=DateToStr(z.DataofDelivery);
x:=1;
StringGrid1.Cells[x,y]:=z.NameGood;
- 86 -

x:=2;
str(z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
x:=3;
str(z.Prise,s);
StringGrid1.Cells[x,y]:=s;
x:=4;
str(z.Prise*z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
allCostwhatYouSee:=allCostwhatYouSee + z.Prise*z.Quantity;
if maxCostOfParty < z.Prise*z.Quantity then
begin
maxCostOfParty:= z.Prise*z.Quantity;
lbl_maxCostotPartyName.Caption:=z.NameGood;
end;
y:=y+1;
end;

end;

end;
end;
LabelMaxCost.Caption:= IntToStr(maxCostOfParty);
lblAllCost.Caption:= IntToStr(allCostwhatYouSee);
{$I-} CloseFile(F); {$I+}
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.Button2Click(Sender: TObject);
var x,y,i:integer;
s:string[10];
begin
for i:=0 to 5 do begin
StringGrid1.Cells[0,i]:='';
StringGrid1.Cells[1,i]:='';
end;
form1.Caption:=' - ['+filename+']';
StringGrid1.Cells[0,0]:=' ';
StringGrid1.Cells[1,0]:=' ';
StringGrid1.Cells[2,0]:='-';
StringGrid1.Cells[3,0]:='';
StringGrid1.Cells[4,0]:=' ';
AssignFile(F,filename);
{$I-} Reset(F); {$I+}
if ioresult<>0 then begin
StringGrid1.Cells[0,1]:=' ';
end
else begin
y:=1;
dataControlCheck:=StrToDate(TEditDataofDelivery.text);
quantityControlCheck:=StrToInt(Minquantity.Text);
maxCostOfParty:=0;
allCostwhatYouSee:=0;
while not eof(F) do begin
- 87 -

read(F,Z);
if (z.DataofDelivery) >= DataControlCheck
begin

then

if z.Quantity>= QuantityControlCheck then


begin
x:=0;
StringGrid1.Cells[x,y]:=DateToStr(z.DataofDelivery);
x:=1;
StringGrid1.Cells[x,y]:=z.NameGood;
x:=2;
str(z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
x:=3;
str(z.Prise,s);
StringGrid1.Cells[x,y]:=s;
x:=4;
str(z.Prise*z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
allCostwhatYouSee:=allCostwhatYouSee + z.Prise*z.Quantity;
if maxCostOfParty < z.Prise*z.Quantity then
begin
maxCostOfParty:= z.Prise*z.Quantity;
lbl_maxCostotPartyName.Caption:=z.NameGood;
end;
y:=y+1;
end;

end;

end;
end;
LabelMaxCost.Caption:= IntToStr(maxCostOfParty);
lblAllCost.Caption:= IntToStr(allCostwhatYouSee);
{$I-} CloseFile(F); {$I+}
end;

{ }
procedure TForm1.SaveButtonClick(Sender: TObject);
var y,Num,Code:integer;
begin
AssignFile(F,filename);
rewrite(F);
y:=1;
if StringGrid1.Cells[0,0] <> ' ' then begin
while StringGrid1.Cells[0,y]<>'' do begin
z.DataofDelivery:=StrToDate(StringGrid1.Cells[0,y]);
z.NameGood:=StringGrid1.Cells[1,y];
val(StringGrid1.Cells[2,y], Num, Code);
z.Quantity:=Num;
val(StringGrid1.Cells[3,y], Num, Code);
z.Prise:=Num;
write(F,Z);
- 88 -

y:=y+1;
end;
end;
{$I-} CloseFile(F); {$I+}
end;
procedure TForm1.SbrosClick(Sender: TObject);
var x,y,i:integer;
s:string[10];
begin
for i:=0 to 5 do begin
StringGrid1.Cells[0,i]:='';
StringGrid1.Cells[1,i]:='';
end;
form1.Caption:=' - ['+filename+']';
StringGrid1.Cells[0,0]:=' ';
StringGrid1.Cells[1,0]:=' ';
StringGrid1.Cells[2,0]:='-';
StringGrid1.Cells[3,0]:='';
StringGrid1.Cells[4,0]:=' ';
AssignFile(F,filename);
{$I-} Reset(F); {$I+}

if ioresult<>0 then begin


StringGrid1.Cells[0,1]:=' ';
end
else begin
y:=1;
TEditDataofDelivery.text:='31.12.1999';
Minquantity.Text:='0';
dataControlCheck:=StrToDate(TEditDataofDelivery.text);
quantityControlCheck:=StrToInt(Minquantity.Text);
maxCostOfParty:=0;
allCostwhatYouSee:=0;
while not eof(F) do begin
read(F,Z);
if (z.DataofDelivery) >= DataControlCheck
begin

then

if z.Quantity>= QuantityControlCheck then


begin
x:=0;
StringGrid1.Cells[x,y]:=DateToStr(z.DataofDelivery);
x:=1;
StringGrid1.Cells[x,y]:=z.NameGood;
x:=2;
str(z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
x:=3;
str(z.Prise,s);
StringGrid1.Cells[x,y]:=s;
x:=4;
str(z.Prise*z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
- 89 -

allCostwhatYouSee:=allCostwhatYouSee + z.Prise*z.Quantity;
if maxCostOfParty < z.Prise*z.Quantity then
begin
maxCostOfParty:= z.Prise*z.Quantity;
lbl_maxCostotPartyName.Caption:=z.NameGood;
end;
y:=y+1;

end;

end;

end;
end;
LabelMaxCost.Caption:= IntToStr(maxCostOfParty);
lblAllCost.Caption:= IntToStr(allCostwhatYouSee);
{$I-} CloseFile(F); {$I+}
end;
procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
ARow: Integer; var CanSelect: Boolean);
begin
SGX:=ACol;
SGY:=ARow;
end;
procedure TForm1.Button3Click(Sender: TObject);
var i:integer;
begin
for i:=SGY to 98 do begin
StringGrid1.Cells[0,i]:=StringGrid1.Cells[0,i+1];
StringGrid1.Cells[1,i]:=StringGrid1.Cells[1,i+1];
end;
end;
procedure TForm1.Button4Click(Sender: TObject);
var i:integer;
begin
for i:=99 downto SGY+1 do begin
StringGrid1.Cells[0,i]:=StringGrid1.Cells[0,i-1];
StringGrid1.Cells[1,i]:=StringGrid1.Cells[1,i-1];
end;
StringGrid1.Cells[0,SGY]:='';
StringGrid1.Cells[1,SGY]:='';
end;
procedure TForm1.Button_FiltersClick(Sender: TObject);
var x,y,i:integer;
s:string[10];
begin
for i:=0 to 4 do begin
StringGrid1.Cells[0,i]:='';
StringGrid1.Cells[1,i]:='';
end;
form1.Caption:=' - ['+filename+']';
StringGrid1.Cells[0,0]:=' ';
StringGrid1.Cells[1,0]:=' ';
StringGrid1.Cells[2,0]:='-';
StringGrid1.Cells[3,0]:='';
StringGrid1.Cells[4,0]:=' ';
AssignFile(F,filename);
{$I-} Reset(F); {$I+}
- 90 -

y:=1;
for i := 0 to 99 do
begin
x:=0;
StringGrid1.Cells[x,y]:='
x:=1;
StringGrid1.Cells[x,y]:='
x:=2;
StringGrid1.Cells[x,y]:='
x:=3;
StringGrid1.Cells[x,y]:='
x:=4;
StringGrid1.Cells[x,y]:='

';
';
';
';
';

y:=y+1;
end;
if ioresult<>0 then begin
StringGrid1.Cells[0,1]:=' ';
end
else begin
y:=1;
if TEditDataofDelivery.text = '0' then TEditDataofDelivery.text:= '11.11.1990';
dataControlCheck:=StrToDate(TEditDataofDelivery.text);
quantityControlCheck:=StrToInt(Minquantity.Text);
maxCostOfParty:=0;
allCostwhatYouSee:=0;
while not eof(F) do begin
read(F,Z);
if (z.DataofDelivery) >= DataControlCheck
begin

then

if z.Quantity>= QuantityControlCheck then


begin
x:=0;
StringGrid1.Cells[x,y]:=DateToStr(z.DataofDelivery);
x:=1;
StringGrid1.Cells[x,y]:=z.NameGood;
x:=2;
str(z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
x:=3;
str(z.Prise,s);
StringGrid1.Cells[x,y]:=s;
x:=4;
str(z.Prise*z.Quantity,s);
StringGrid1.Cells[x,y]:=s;
allCostwhatYouSee:=allCostwhatYouSee + z.Prise*z.Quantity;
if maxCostOfParty < z.Prise*z.Quantity then
begin
maxCostOfParty:= z.Prise*z.Quantity;
lbl_maxCostotPartyName.Caption:=z.NameGood;
end;
y:=y+1;
- 91 -

end;

end;

end;
end;
LabelMaxCost.Caption:= IntToStr(maxCostOfParty);
lblAllCost.Caption:= IntToStr(allCostwhatYouSee);
{$I-} CloseFile(F); {$I+}
end;
end.
Result:

- 92 -

- 93 -

- 94 -

Оценить