1.
- . : , , . :
- ().
- ().
- ().
- ().
, :
- , ( );
- ();
- , ().
, : , , , , , .
, , , . , .
:
- Turbo.exe ;
- Turbo.hlp , ;
- Turbo.tp ;
- Turbo.tpl .
Graph.tru , *.BGI , *.CHR, .
: ( ) , , . F10.
, : , RunRun.
, : , FileSave(Saveas), Enter.
: , FileExit.
, , . . ( , , , ).
:
- : A,B,CY,Z,a,b,c,y,z;
- : 0, 1, 2,9;
- : + - * / > < =; # ,.: {} [] ()
- , , : :=, .., <>, <=, >=, {}.
- , . , . : , .
( .1) . .
|
|
(identification ). , .. , Sqr,Sqrt .. Sqr , , Sqrt . , , . , . :
- ( ).
- , .
- 127 .
- .
- .
Absolute | Library | ||
And | Mod | ||
Array | Not | ||
Begin | Or | ||
Case | Of | ||
Const | Object | ||
Div | Procedure | ||
Go to | Program | ||
Do | Repeat | ||
Downto | String | ||
Else | Then | ||
End | To | ||
File | Type | ||
For | Until | ||
Function | Uses | ||
If | Var | ||
Interrupt | While | ||
Interface | With | ||
Label | Xor |
1
, , . , , . , , . , , . , , .
1.
- , . . . ().
, , , . , , . , (.1.2.) .
|
|
, ( . , , [1]).
1.
, . , :
- ;
- ;
- ( . , 64 . ).
:
- , program . , .
- , 2 :
1. , , . :
( uses);
;
;
;
;
;
( 1), , . (. 1.2.).
.
2. .
Begin End. , . , , . End .
:
- program,procedure,function .. ;
- ;
- ;
- 1 1- 2 .
1.
, , , .. , , . , . . : () (). . , .
:
1.
2.
|
|
3.
, . (, [1]). , 4 5.
1.
() | ||
Byte Shorint Integer Word Longint | 0255 -128 127 -32768 32767 0 65535 -2147483648 2147483647 |
2 : . , $, 9 AF. $0000 $FFFF.
1.
() , : .
() | |||
Real Single Double Extended Comp | 2.9*10E-39 1.7*10E38 1.5*10-45 3.4*1038 5.0*10-324 1.7*10308 1.9*10-4951 1.1*104932 -2+63+1 2+63-1 | 11 12 7 8 15 16 19 20 10 20 |
. , Real, Intel8087/80287.
, . , . + -. , .
: mE+p, m ( ), 10 , ( ).
, 5.18+2 = 5.18 * 102 = 518
10-03 = 10 * 10 3= 0.01
1.
() char . 0 255. ASCII. 'A' 192
1 .
1.
() boolean : true () false (). . - 1 .
1.
, , , . . . , , . .
+ | , | , | |
- | , | , | |
* | , | , | |
/ | , | ||
DIV | |||
MOD | |||
+ | , | , | |
- | , | , |
|
|
, . , , : .
= | = | |
<> | <>B | |
> | A>B | |
< | A<B | |
>= | A>=B | |
<= | A<=B |
Abs(x) | , | , | |
Arctan(x) | , | ||
Cos(x) | , | ||
Exp(x) | , | - | |
Frac(x) | , | ||
Int(x) | , | ||
Ln(x) | , | ||
Random | [0,1] | ||
Random(x) | [0,] | ||
Round(x) | |||
Sin(x) | , | ||
Sqr(x) | , | ||
Sqrt(x) | , | ||
Trunc(x) | , |
TrueFalse. , , . :boolean.
4 : -NOT, -AND, -OR, -XOR. :Ttrue,Ffalse.
A | B | Not A | A and B | A or B | A xor B |
T | T | F | T | T | F |
T | F | F | F | T | T |
F | F | T | F | F | F |
F | T | T | F | T | T |
: not,and,or,xor. (=, <> ) , , .
. , , (x,y) , . 2 : x£0;y³-x-3 y2+x2£9, -x³0 x2+y2£25.
: 2 . 1: x<=0; x2+y2<=9; y>= - x-3.
2: x>=0; x2+y2<=25.
(x,y) , 1 2 .
Program point;
Var x, y:real; L:boolean;
Begin
Writeln( y);
Readln(x,y);
L:= (x<=0) and (sqr(x)+sqr(y)<=9) and (y>=-x-3) or
(x>=0) and (sqr(x)+sqr(y)<=25);
writeln( ?,L);
end.
:
x y
2 0 { 2 0}
?TRUE
( ):
- ;
- , not;
- , , div,mod,and;
- , , or,xor;
1.
. . - , ( , , ). : Read,Readln,Write,Writeln.
1.
Read . :Read(< >);
. . Read Enter. . , .
|
|
Readln Read, , .
:
Program primer;
Var i, k:integer; c,d, s: real;
begin
readln (c,d);
read(i,k);
end.
. , , d , . ( ln Read). , ik.
1.
Write .
: Write(< >);
(integer,real,char ..) , .
, Write(); Write(34.7); Write(45+55); Write(b, d);
Writeln Write. , .
WriteWriteln , .
:
I,p,q ;
R- ;
# - ;
* - + -;
_ - .
I | ||
Write(I); | ||
Write (I, I, I); | ||
Write (I: 6); | ___324 | |
Write (I + I: 7); | ____624 | |
R | ||
123.432 | Write(R); | __1.2343200000E+02 |
-1.34E+01 | Write (R); | _ -1.3400000000E+01 |
304.55 | Write (R:15); | 3.045500000E+02 |
R | ||
304.66 | Write(R:8: 4); | 304.6600 |
45.322 | Write (R: 5: 2); | 45.32 |
:
Program primer;
Var
a, b, c, sum:integer;
begin
a:=4; b:=6; c:=55;
Write(a:3); Write(b:3); Write(c:3);
Sum:=a+b+c;
Writeln (A=,a);
Writeln (B=,b);
Writeln (C=,c);
Writeln ( A+B+C , sum);
End.
:
4 6 55
=4
=6
=55
++ 65
2.
, , . . . , , . , , , . , . : , .
2.
, , . . . , , . , , , . , . : , .
2.
, . , , . , , (begin), .
, ClrScr; { }. 3.
2.
(goto) , , - , , . :goto<>.
. , 127 . Label, .
.
Program primer;
Label 999, metka;
Begin
.
Go to 999;
999: write ( );
Go to metka;
.
Metka: write();
end.
, , . :
- () ;
- ( ).
2.
. , , . end , :
Label m;
begin
go to m;
m:
end;
2.
, . : , . , - , . ( :)
2.
, , beginend. , .
2.
, ( ). . If. , .
:
If<>then<1>
else<2>;
If<>then<>;
. , . () . , 1, then. , 2. , 1 2 , beginend.
, else .
1. , (³7).
Program sh;
Var v: integer;
Begin
Write( );
Readln(v);
If v>=7 then writeln( )
else writeln ( );
end.
. , 16 .
:
Program sh;
Var v: integer;
Begin
Write( );
Readln(v);
If (v>=7) and (v<=16) then writeln( )
else writeln ( );
end.
2. . , - .
Program sh;
Var x, y,s,p: integer;
Begin
Write( 2 );
Readln(x, y);
S:=x+y; p:=x*y;
If x>=y
then begin y:=s; x:=p; end
else begin x:=s; y:=p; end;
writeln(x=, x);
writeln(y=, y);
end.
If , , . Case. , .
: Case k of
<const1>: <1>;
<const2>: <2>;
..
<constN>: <N>
else<N+1>
end;
k -, (, , ). <const1>, <constN> - , .
Case . -, , . , , else. , , Case, .. end.
Case :
1. - (, , ).
2. , , , .
3. .
:
:
Case I of
1..10: writeln( 1-10);
11.. 20: writeln( 11-20);
elsewriteln( )
end;
:
Case I of
1: y:= I+10;
2: y:= I+20;
3: y:= I +30;
end;
1. , .
Program days;
Var day:byte;
Begin
Write( );
Readln(day);
Case day of
1: writeln();
2: writeln();
3: writeln();
4: writeln();
5: writeln();
6: writeln();
7: writeln()
elsewriteln( );
end; end.
2. , .
Program m;
Var k:byte;
Begin
Write( );
Readln(k);
Case k of
1, 2, 12: writeln();
3, 4, 5: writeln();
6, 7, 8: writeln();
9, 10, 11: writeln()
elsewriteln( );
end;end.
2.
()
, (). : (while), (repeat) (for).
, , .
:
1) for< >:= < >to< >do
< >
2) for< >:= < >downto< >do
< >
, ; < > - . . 1, - 1.
for , . .
1. <= .
2. , ( ), , , .
3. ( 1 1).
, beginend;
1. 15 30 1. :F=C*1.8+32.
Program zf;
Var i:integer; f:real;
Begin
Writeln();
For i:=15 to 30 do
Begin
F:=i*1.8+32;
Writeln( ,i, ,f:5:2);
End;
End.
2. 1 9 .
Program z;
Var i:integer;
Begin
For i:=9 downto 1 do
Writeln(i);
End.
, ( ), while repeat. While . .
: While< >do
< >;
. , beginend.
. , . , while.
. 10 .
Program z;
Const
N=10;
Var k, x, s: integer;
Begin
k:=0;s:=0; {k- }
while k < n do
begin
k:=k+1;
write( );
readln(x);
s:=s+x;
end;
writeln( , s);
end.
repeat while, , -, , . -, , true. , , , until, . repeat , .
: Repeat
<>
.....
<>
until< >
, . . , .. False, . , . , , , .
. , . 999, .
Program s;
Var x, s:integer;
Begin
S:=0;
Repeat
Write( );
Readln(x);
If x<>999 then s:=s+x;
Untilx=999;
Writeln( ,s);
End.
3.
6.0. 8 : System,Crt,Dos,Graph,Graph3,Overlay,Printer,Turbo3 TurboVision. System , ( 1.3.). uses . :usesCrt.
.
System- . , , .
Crt- .
Dos- , Dos.
Graph3 - .
Overlay- .
Printer- .
Turbo3 - 3.0.
Graph- .
TurboVision- - .
Crt . , , .. . .
TextMode(Mode:integer);
Mode 1 (40 / 25) 3(80 / 25).
ClrScr ;
ClrEol , ;
GotoXY(x,y) , x,y.
TextColor(Color:byte) - ;
TextBackGround(Color) .
, Blink(16).
. .
Program primer;
Uses crt;
Begin
TextMode(3);
Clrscr;
Gotoxy(36,12);
Textcolor(5+16);
Write();
End.
3.
- , ( ). () . procedure, , , . , , . , .
, , , , , .
, , , .
:
Procedure<> ( , );
Const;ù
ý
Var.;û
begin
<>
end;
1. , .
Program names;
Uses crt;
Procedure name(x, y, c: byte,);
Begin
Gotoxy (x, y);
Textcolor(c); {textcolor (c+16);}
Write();
end;
begin
Clrscr; { }
name (2,2, 14);
name (2, 22, 8);
name (75,2, 3);
name (75, 22, 5);
End.
2. , .
Program max;
Uses crt;
Var a, b, c, d, m, p, q:real;
Procedure Bd(x,y:real, var z: real);
Begin
If x>y then z:=x
else z:=y;
end;
begin
Clrscr; { }
Write( );
Readln(a,b,c,d);
Bd (a, b, p);
Bd (c, d, q);
Bd (p, q, m);
Writeln( ,m:8:3);
End.
3.
- , , ( ). , , . Function, , ( ) . , . :
Function<> (<>): < >;
Const;ù
ý
Var .; û
begin
<>
end;
, , . . .
1. :F(t) F(c), F(x)=Öx+2x2+3x
Program m;
Uses crt;
Var t, c, r: real;
Function F(x: real): real;
Begin
F:= sqrt(x)+ 2*sqr(x) + 3*x;
End;
Begin
Clrscr;
Write( );
Readln (t, c);
r:= F(t) F(c);
write( =, r:8:3); {8 , 3 , .1.4.2}
end.
2. , .
Program max;
Uses crt;
Var a, b, c, d, m, p, q:real;
Function Bid(x, y: real): real;
Begin
If x>y then bid:=x
else bid:=y;
End;
Begin
Clrscr;
Write( );
Readln (a, b, c, d);
p:=bid(a, b);
q:= bid(c, d);
m:=bid(p, q);
write( , m:8:3);
end.
4.
, , : . , , . , . : () ( 5).
-, .
, , , , .
, , () , .
, , . , , , (), . . : < >[<>].
, . :
Type< >=array[< >] of < >;
, , . :
Var < >: array [< >] of < >;
.
() , , .. , .. .
( ) , . for. : , , .
, . , , , ..
:
()
1. (10), . , k.
Program massiv;
Uses crt;
Var b:array [1..10] of integer;
I, k, s: integer;
Begin
Clrscr; S:=0;
For i:=1 to 10 do
Begin
Write(,i, - );
Readln (B[i]);
Write(b[i], );
End;
Write( k);
Readln(k);
For i:=1 to 10 do
If b[i]>k then s:=s+1;
Write( ,s);
End.
2. .
Program massiv;
Uses crt;
Var t:array [1..31] of integer;
I, max, n: integer;
Begin
Clrscr;
For i:=1 to 31 do
Begin
t[i]:=random(20);
Write(b[i], );
End;
Max:=t[1]; n:=1;
For i:=2 to 31 do
Begin
If t[i] > max then max:=t[i]; n:=i;
End;
Write( ,max, ,n, );
End.
4.
, . , . , . :
Var a: array [1..10] of array [1.. 20] of real;
Var a: array [1..10, 1..20] of real;
. ( , ). . for.
, For i:= 1 to 10 do
For j:= 1 to 20 do
A[i, j]:= 0;
() :
, ,
, ,
.
1. ( ) .
Program Pifagor;
Uses crt;
Var p: array[1..9, 1..9] of integer; i, j:integer;
Begin
Clrscr;
for i:=1 to 9 do
for j:= 1 to 9 do
p[i,j]:= i*j;
for i:=1 to 9 do
begin
for j:=1 to 9 do
write(p[i,j], );
writeln
end;
end.
2. (10, 10),
[-10,10]. , k.
Program massiv;
Uses crt;
Var b: array[1..10, 1..10] of integer; i, j, k:integer;
Begin
Clrscr;
for i:=1 to 10 do
begin
for j:= 1 to 10 do
begin
b [i,j]:= random(20)-10;
write(b[i,j], );
end;
writeln;
end;
write( k);
readln (k);
For i:=1 to 10 do
For j:=1 to 10 do
If b[i, j] >k then write (b[i, j]);
End.