2.10. Y=*(1--) Z=*s(*-/3) 5 0,01. , , . . . ϳ .
3. Ͳ
3.1. .
3.2. .
3.3. , .
3.4. .
3.5. , .
3.6. .
' 7
˲ ² ""
"" .
1. Ͳ ²Ҳ
1.1. "" :
1) ³ ;
2) Alt-F9. Compile\Destination\Disk . ϳ .TPU, , BIBLIO.TPU;
3) Uses, , Uses BIBLIO;
4) .
1.2. :
Unit < >;
{$ }
Interface
Uses < >;
Label < >;
Const < >;
Type < >;
Var < >;
Procedure < 1- >;
Procedure < N- >;
Function < 1- >;
Function < N- >;
Implementation
Uses < >;
Label < >;
Const < >;
Type < >;
Var < >;
Procedure < 1- >;
< 1- >;
Procedure < N- >;
< N- >;
Function < 1- >;
< 1- >;
Function < N- >;
< N- >;
Begin
< 1>;
< N>;
End.
1.3. Unit , , 8 .
|
|
, .
Interface , . , , , , , , Uses, Label, Const, Type, Var, Procedure, Function. . - , , . Interface .
Implementation . , . . - , , , Implementation .
Begin End, , , , . .
1.4. 1. , =2002; =0,02; =2,73.
Unit Constant;
Interface
Const
A=2002;
H=0.02;
K=2.73;
Implementation
Begin
End.
1.5. 2. , .
Unit ScrClear;
Interface
Implementation
Uses Crt;
Begin
ClrScr;
End.
1.6. 3. , , .
Unit Biblio;
Interface
Procedure CF (Color, Fon:byte);
Procedure Beep;
Implementation
Uses Crt;
Procedure CF;
Begin
TextColor (Color);
TextBackGround (Fon);
End;
Procedure Beep;
Begin
Sound (3000);
Delay (1000);
NoSound;
End;
Begin
End.
2.
"", .
2.1. 4 "" : , ϲ , , 쳿, . ϳ 䳿, "4'. .
2.2. 4 "" : ϲ , "", "4", "5", . , "", "4" 25% "5" . .
2.3. 4 "" : , , , ' . , . .
|
|
2.4. 4 "" : ϲ , ' , , . , ' . ³ . 쳿 .
2.5. 4 "" : ϲ , "", "4", "5". () "", "4" "5". .
2.6. 4 "" : ϲ , , "", "4", "5". , , 3,9. .
2.7. 4 "" : , ϲ , , , . , "4" "5". .
2.8. 4 "" : ϲ , "", "4", "5", . , . .
2.9. 4 "" : , ϲ , , , . , "5", "4'. .
2.10. 4 "" : ϲ , "", "4", "5", . . .
3. Ͳ
3.1. .
3.2. .
3.3. .
3.4. .
3.5. .
3.6. .
3.7. .
' 8
̲Ͳ ̲Ͳ ""
"" .
1. Ͳ ²Ҳ
1.1. ϳ . 64. , , Uses, . , , , Const Var.
|
|
, , Heap - . Heap - {$M} Options\Compiler\Memory Size. 16384 , ' 655360 ,
{$M 16384, 0, 655360}
1.2. Heap - . ' , , , ' .
Heap - ᒺ , , .
1.3. ', . Var .
^ () ' . , Alfha, I,
Var
Alfha: ^real;
I: ^integer;
' ' ,
New (Alpha);
New (I);
'
Dispose (Alpha);
Dispose (I);
' 8 , 6- real 2- integer 8 .
pointer ' . , Beta
Var
Beta:pointer;
' ' ' ' , 64. '
GetMem (Beta, 32);
FreeMem (Beta, 32);
' ', , . ' ' word.
1.4. ' ' MemAvail MaxAvail longint, ' ' ' ' .
1.5. ϳ ' , , , . ^ () .
1. .
Program Dinamic_Var;
|
|
Uses Crt;
Var
a, b, c: ^real;
Begin
TextColor (blue);
TextBackground (lightgray);
ClrScr;
New (a);
New (b);
New (c);
Write (' : ');
Readln (a^,b^);
c^:=a^+b^;
Writeln (' : ',c^:9:2);
Dispose (a);
Dispose (b);
Dispose (c);
Readln;
End.
1.6. , .. Nil
Beta:= Nil;
1.7. - . , . ' , . . Nil. . .
2. , ϲ , .
Program SimpleList;
Uses Crt;
{ }
Type
PhonePtr=^PhoneRec;
PhoneRec=record
Name:string[30];
Address:string[50];
Phone:string[15];
Next:PhonePtr;
end;
Var
FirstPhone, CurrPhone,
PrevPhone, WritePhone:PhonePtr;
Ch:char;
{ ϳ }
Procedure EnterPhone;
begin
with CurrPhone^ do
begin
ClrScr;
Write (' ϲ: ');
readln (Name);
Write (' : ');
readln (Address);
Write (' : ');
readln (Phone);
end;
end;
{ ϳ }
Procedure NewPhone;
begin
if FirstPhone=Nil then
begin
New(CurrPhone);
EnterPhone;
FirstPhone:=CurrPhone;
PrevPhone:=CurrPhone;
CurrPhone^.Next:=Nil;
end
else
begin
PrevPhone:=CurrPhone;
New (CurrPhone);
EnterPhone;
PrevPhone^.Next:=CurrPhone;
CurrPhone^.Next:=Nil;
end;
end;
{ ϳ }
Procedure OutputPhones;
begin
WritePhone:=FirstPhone;
While WritePhone <> Nil do
begin
with WritePhone^ do
Writeln (Name, ',',Address, ',',Phone);
WritePhone:=WritePhone^.Next;
end;
Repeat Until KeyPressed;
end;
BEGIN
FirstPhone:=Nil;
{ }
ClrScr;
GotoXY (1,24);
TextColor (yellow);
Writeln ('() , () ,
()');
Window (1,1,80,23);
TextColor (red);
Repeat
ClrScr;
Repeat
Ch:=Readkey;
Until Ch IN ['','','','','',''];
Case Ch of
'','':NewPhone;
'','':OutputPhones;
end;
Until Ch IN ['',''];
ClrScr;
END.
1.8. ' . . 䳿 :
1) ;
2) word
ImageSize (<x1,y1,x2,y2:integer>);
x1,y1 x2,y2 ', 64, ;
3) GetMem, ', ImageSize;
4) '
GetImage (<x1,y1,x2,y2:integer>,<>);
5) '
PutImage (<x,y:integer>,<>,<>);
x y, <> . . . 1.1.
. 1.1.
CopyPut NormalPut ( 0) | |
XORPut ( 1) | Δ |
ORPut ( 2) | Δ |
ANDPut ( 3) | |
NOTPut ( 4) | Ͳ ( ) |
|
|
1.9. . , SetColor. Գ, , (, )
SetFillStyle (<>,<>);
11 . 1.2.
. 1.2.
EmptyFill ( 0) | |
SolidFill ( 1) | |
LineFill ( 2) | |
LtSlashFill ( 3) | |
SlashFill ( 4) | |
BkSlashFill ( 5) | |
LtBkSlashFill ( 6) | |
HatchFill ( 7) | |
InterLeaveFill ( 8) | |
WideDotFill ( 9) | |
CloseFill ( 10) | г |
Fill ( 11) | |
UserFill ( 12) |
,
SetFillStyle (1, white);
100, 50 300, 150
Rectangle (100,50,300,150);
300, 200 50
Circle (300,200,50);
300, 200, 90 270 50
Arc (300,200,90,270,50);
.
300, 200, 90 270 50
PieSlice (300,200,90,270,50);
300, 200, 90 270 50 150
Ellipse (300,200,90,270,50,150);
300, 200, 90 270 50 150
Sector (300,200,90,270,50,150);
300, 200 50 150
FillEllipse (300,200,50,150);
100, 50 200, 250
Bar (100,50,200,250);
100, 50 200, 250 10 , TopON True,
Bar3D (100,50,200,250,10,TopON);
TopOFF False.
x y, PointType. , . ()
DrawPoly (< :word>,
< :PointType>);
3. , .
Uses Graph;
Const
{ 4- }
Triangle:array [1..4] of PointType=
((x:50; y:100), (x:100; y:100),
(x:150; y:150), (x:50; y:100));
Var
grDriver:Integer;
grMode:Integer;
ErrCode:Integer;
Begin
grDriver:= Detect;
InitGraph (grDriver, grMode,'F:\TP\BGI');
ErrCode:= GraphResult;
if ErrCode = grOk then
begin
{ }
SetColor (green);
{ }
DrawPoly (4, Triangle);
Readln;
CloseGraph;
end
else
Writeln(GraphErrorMsg(ErrCode));
End.
'
FillPoly (< :word>,
< :PointType>);
1.10. () , SetFillStyle. , . -
FloodFill (<x,y:integer>,< :word>);
4. .
Uses Graph;
Var
grDriver:Integer;
grMode:Integer;
ErrCode:Integer;
Begin
grDriver:= Detect;
InitGraph (grDriver, grMode,'F:\TP\BGI');
ErrCode:= GraphResult;
if ErrCode = grOk then
begin
{ }
SetColor (red);
Circle (200, 100, 50);
Readln;
{
}
SetFillStyle (1, blue);
{ }
FloodFill (200, 100, red);
Readln;
CloseGraph;
end
else
Writeln(GraphErrorMsg(ErrCode));
End.
1.11. 5. .
Uses Graph, Crt;
Const
Radius=20;
Var
grDriver:Integer;
grMode:Integer;
ErrCode:Integer;
Size,X,Y,I:Word;
P:Pointer;
Begin
grDriver:= Detect;
InitGraph (grDriver, grMode,'F:\TP\BGI');
ErrCode:= GraphResult;