.


:




:

































 

 

 

 


1)

. :


1. , .. , .

: () . : ; , , ; ; ;


2. -, 1, .

( ) ().


3. , .. -.

. , . -. - ( , , , , ..) , . , . , -.


4. , .. .

cls
input a, b
c = a + b
print c

 

2) (. Pascal) . , [4], , .

:

  • :

,,...,X,Y,Z,a,b,c,...,x,y,z.

, Turbo Pascal . .

  • 0 9:

0,1,2,3,4,5,6,7,8,9

.

  • :

+ -*/-><.,;: ()[ ]{ }#$

, , , .

.

Pascal- - .

- , .

Turbo Pascal :

1. () .
, . , . , (.. , ..).

55 .

absolute array and asm assembler
begin case const constructor destructor
div downto else end external
file for forward function goto
if implementation in inline interface
interrupt label mod nil not
object of or packed private
procedure program record repeat set
shl shr string then to
type unit until uses var
virtual while with xor  

, Turbo Pascal ( assembler, external, forward, interrupt, private, virtual). , . .

2. (). , , , , , .

, 63 .

, Turbo Pascal . , :

index
INDEX
Index

3. . , . .

4. .

5. . :

;: = (.

 

Pascal- - . .

 

Turbo Pascal ( ; ), '{' ')' ' (*' '*) :

{ }

(* ,

*)

 

, Const.

 

Pascal :

. 2 147 483 648 + 2 147 483 647. , , .

, e, . , 3.14e5 3,14*105. 3.14e-4 3,14*10-4.

, $ . $00000000 $FFFFFFFF.

 

:

 

, ( 0 9999).

 

.. . . . . .. .

 

LABEL LB1, LB2, R8; LABEL 10, 120, 55;

 

3) Program...; { }

 

Uses...; { }

 

Label...; { }

 

Const...; { }

 

Type...; { }

 

Var...; { }

 

Procedure...; { }

 

Function...; { }

 

Begin { }

 

...;

 

{ }

 

...;

 

End.

 

, begin, end . . , program - , . .

 

4) , . , :

 

Program PRIM;

:

 

();

;

;

;

;

.

USES () Turbo Pascal, . . :

 

uses CRT, Graph;

5)

 

, . .

 

, 256 . , , .

, , ,

.

 

, ,

, .

 

Shortint -128.. 127 1

Integer -32768.. 32767 2

Longint -2147483648.. 2147483647 4

Byte 0.. 255 1

Word 0.. 65535 2

: , , , ,

. :

 

+ - * div mod

 

-

.

.

- . :

 

17 div 2 = 8, 3 div 5 = 0.

17 mod 2 = 1, 3 mod 5 = 3.

 

, ,

TRUE FALSE ( ).

: =,

<>, >=, <=, >,

<.

(-

) , :

 

Abs(X), Sqr(X), Succ(X), Pred(X),

 

, -

, +1, -1.

-

:

 

Sin(X), Cos(X), ArcTan(X), Ln(X), Exp(X), Sqrt(X).

 

, ,

, , -

.

Odd(X) , ,

, :

 

X=5 Odd(X)=TRUE, X=4 Odd(X)=FALSE.

 

:

 

Inc(X) X:=X+1

Inc(X,N) X:=X+N

Dec(X) X:=X-1

Dec(X,N) X:=X-N

 

,

, .

 

1. 2. 3.

4. ()

 

1 2 3 4

---------------------------------------------------------------

Real 2.9e-39.. 1.7e+38 11 6

Single 1.5e-45.. 3.4e+38 7 4

Double 5.0e-324.. 1.7e+308 15 8

Extended 3.4e-4932.. 1.1e+4932 19 10

Comp -9.2e+18.. 9.2e+18 19 8

---------------------------------------------------------------

 

Real -

.

IEEE 457 -

.

80486 {$ N+},

- {$N-,E+}.

Comp ,

.

-

, :

 

+, -, *, /.

 

,

.

, , .

, -

:

 

Abs(X), Sqr(X), Sin(X), Cos(X), ArcTan(X), Ln(X), Exp(X),

Sqrt(X), Frac(X), Int(X), Pi.

 

Frac(X) X, Int(X) -

X.

Pi -

.

 

Trunc(X) Round(X),

 

. -

,

.

 

(Boolean) , -

TRUE FALSE.

:

 

not and or xor.

 

, FALSE < TRUE. -

.

:

ByteBool, WordBool LongBool, ,

.

 

(Char) -

, .

- .

:

- , , :

 

'A' 'a' '' '';

 

- #K, K - -

, K 0..255;

- ^C, C - -

, C 64

.

.

 

Ord(C) Chr(K).

 

-

, ,

- . .

, -

:

 

Pred(C) Succ(C). Pred('F') = 'E'; Succ('Y') = 'Z'.

 

-

.

'a'..'z' UpCase(C), -

'A'..'Z'.

 

(Pointer) , -

.

(4 ), ,

- .

()

, , -

@.

 



<== | ==>
II. | . .
:


: 2016-12-18; !; : 385 |


:

:

, .
==> ...

1693 - | 1564 -


© 2015-2024 lektsii.org - -

: 0.078 .