.


:




:

































 

 

 

 


II. Object Pascal




 

program < >;

 

uses < >;

label < >;

const < >;

type < >;

var < >;

 

< >

 

begin

< , , >;

end.

 

- .

 

III.

1.

1.1.

1.1.1. ֳ

1. ֳ Object Pascal

 

( ) ij ³ Turbo Pascal 7.0
Byte   0..255 Byte
Shortint   -128..127 Shortint
Word   0.. 65535 Word
SmallInt   -32768.. 32767 Integer
Cardinal   0.. 232-1 -
Integer   -231 .. 231-1 Longint
Int64   -263 .. 263-1 -

 

1.1.2.

Boolean ( true false)

1.1.3.

Char (Ansi Char) 1 ( ANSI)

WideChar 2 ( Unicode)

1.1.4.

, Seasons = (Winter, Spring, Summer, Autumn);

1.1.5. ij

, Days = 1..31

 

1.2. ij

2. ij Object Pascal

 

( ) ij ³ Turbo Pascal 7.0
Single   1.5x1045.. 3.4x1038 Single
Real   5.0x10324.. 1.7x10308 Double
Real48   2.9x10-39.. 1.7x1038 Real
Comp   263+1.. 263 1 Comp
Currency   -1015.. 1015 -
Double   5.0x10324.. 1.7x10308 Double
Extended   3.6x104951.. 1.1x104932 Extended

 

2.

2.1. (array)

2.2. (set of)

2.3. (file of, text)

2.4. (record)

3. (pointer)

4. (string)

5. (procedure)

6. (variant)

7. (class)

8. (interface)

 

.

, ᒺ .

 

IV.

+ * / div ( ), mod ( ).

not ( )

and ( )

or ( )

xor ( 2)

shl ( )

shr ( )

  1. + ()
  2. + () () * ()
  3. ³

= <> > < <= >= in ( )

  1. @
  2. ᒺ: is, as

V. ( )

1. @, not

2. *, /, div, mod, and, shl, shr, as

3. +, , or, xor

4. =, <>, <, >, <=, >=, in, is

VI.

.

 

1. ( )

 

1.1.

 

<>:= <>;

 

1.2.

 

< > (< >);

 

1.3.

 

goto <>;

 

2.

;

 

3. ( )

 

3.1.

 

begin

< >

end;

 

3.2.

 

3.2.1.

 

if <> then <>,

 

<> Boolean

 

3.2.2.

 

if <> then <1>

else <2>

 

3.2.3.

 

case < > of

<1>:<1>

<2>:<2>

//

< n>:< n>

else <>

end;

 

< > ,

<1>< n> .

 

3.3.

 

3.3.1.

 

repeat

<1>

//

< n>

until < >;

 

3.3.2.

 

while < > do

begin

<1>

//

< n>

end;

 

3.3.3.

 

for < >:= < > to

< > do <>; // = 1

for < >:= < > downto

< > do <>; // = -1

 

3.3.4.

 

continue; //

break; //

exit; //

 

  1. .

. .

 

type

< >= array [< >] of < >;

var

< >: < >;

//

< >: array [< >] of < >

 

:

 

var

A1: array [1..10] of Byte;

For i:=1 to 10 do

A1[i]:= i*2;

 

. , .

 

. .

 

:

 

type

TDigit = set of 0..9;

TColor = set of (Red, Green, Blue);

 

var k: set of Char = [Y,y,N,n];

Key: Char;

If not (Key in K) then exit;

 

, .

 

type

< >= record

< 1>: < 1>;

//

< n>: < n>;

end;

 

with

 

:

 

type

TPoint= record

X, Y: Real;

end;

 

var aPoint1, aPoint2: TPoint;

begin

aPoint1.X:= 10.5;

aPoint2.Y:= -7.2;

with aPoint2 do

begin

X:= 4.2;

Y:= 6.9;

end;

end.

 

4.:

 

.

 

type < > = ^< >

var

< >: < >;

//

< >: ^< >

 

 

type TPoint= record

X, Y: Real;

end;

 

var P1:^TPoint;

begin

New(P1); //

P1^.X:=5; // P1^.Y:=3; // (^ . caret)

Dispose (P1); //

end;





:


: 2016-07-29; !; : 628 |


:

:

- , .
==> ...

1745 - | 1560 -


© 2015-2024 lektsii.org - -

: 0.023 .