. , , ,

,,,

. TYPE. — ,

..

- (, - ShortInt, Byte, Integer, Word, LongInt, Char Boolean). , , -1 99. LongInt Integer (!), ShortInt, . , -1 99 :

VAR x : -1..99;

. x -1,0,1,...,99 , . , , , .. , - ShortInt. -1..200 , Integer, 0..200 - Byte. . , .

WRITE(' x:-1..99 ',SizeOf(x),' ');

, 1.

, Char Boolean (, ). , , , :

VAR Letter : 'a'..'z';

, :

VAR RusLetter : ''..'';

1 .. 2,

. , TYPE :

TYPE = ;

TYPE , , . TYPE, , , , . , , :

CONST Tmin=-5;

Tmax=15;

TYPE T_Range_Type=Tmin..Tmax;

VAR t:T_Range_Type;

TYPE T_Range_SubType=Tmin+3..Tmax-5;

VAR t1:T_Range_SubType;

, , , .

, , . - () . :

ARRAY [ ] OF

- ShortInt, Byte, Char, Boolean ; - , . , , , , , Word - Byte. , (64 - 2) , 65534 . , VAR a : ARRAY[1..65534] OF BYTE;

VAR a : ARRAY[1..65535] OF BYTE;

VAR a : ARRAY[1..33000] OF WORD;

. - , , , , . , 1. :

VAR a : ARRAY[Char] OF 1..5;

- 256 , 1 5, #0 #255;

CONST Max = 99;

Min = 10;

TYPE Nums = Min..Max;

TYPE ArrayType = ARRAY[-10..0] OF Nums;

VAR a : ArrayType;

- 11 -10 0, - ;

TYPE IndexType = 'a'..'z';

VAR a : ARRAY[IndexType] OF BOOLEAN;

- 26 'a' 'z', - .

, . :

[ ]

- . - , , . . , :

VAR a : ARRAY[1..3] OF REAL;

b,c,d : ARRAY[1..3] OF REAL;

TYPE Massiv=ARRAY[1..3] OF REAL;

VAR e,f : Massiv;

g : Massiv;

h,i : Massiv;

b,c,d - e,f,g,h,i , a b (a c,a d) ; b (c,d,a) e (f,g,h,i) ! , , , ! .

, ( ) :

{ N , N 20, }

CONST Nmax=20;

TYPE IndexType=1..Nmax;

Massiv=ARRAY[IndexType] OF Integer;

VAR a : Massiv; i,j,N : IndexType; t : Integer;

BEGIN WRITELN;

REPEAT WRITE(' 1 ',Nmax,' ');

READ(N); WRITELN;

UNTIL (N>=1)AND(N<=Nmax);

{ }

WRITELN(' ');

FOR i:=1 TO N DO READ(a[i]);

{ . ,

-

, , }

FOR i:=1 TO N-1 DO FOR j:=i+1 TO N DO

IF a[i]>a[j] THEN BEGIN t:=a[i]; a[i]:=a[j]; a[j]:=t; END;

{ }

WRITELN(' :');

FOR i:=1 TO N DO WRITE(a[i]:8);

END.

! a[i]:=a[j]; a[j]:=a[i]; , , . , , . - i 1 N-1 ai, ai+1, ... , aN i- ; , , .

FOR i:=1 TO N-1 DO BEGIN

a_max:=a[i]; n_max:=i;

FOR j:=i+1 TO N DO

IF a[j]<a_max THEN BEGIN a_max:=a[j]; n_max:=j; END;

IF n_max<>i THEN BEGIN a[n_max]:=a[i]; a[i]:=a_max; END;

END;

, , a_max - Integer n_max - IndexType. - , , .

. , , , . , , , , :

VAR a : ARRAY[1..10] OF ARRAY[1..20] OF Real;

a a[i] ; . a[ , ] Real, , a[i+1,3]. , : a[i+1][3], . :

ARRAY[ t1 ] OF ARRAY[ t2 ] OF ARRAY ... OF t ;

ARRAY[ t1 , t2 , ... ] OF t ;

, , . , , , :

CONST Nmax=20; { }

TYPE IndexType=1..Nmax;

Matrix =ARRAY[IndexType,IndexType] OF Real;

VAR a,b,c : Matrix; n,i,j,k : IndexType;

BEGIN WRITE(' '); READ(n);

IF (n<1)OR(n>Nmax) THEN BEGIN

WRITELN(' !'); Halt; END;

WRITELN(' A ');

FOR i:=1 TO n DO FOR j:=1 TO n DO READ(a[i,j]);

WRITELN(' B ');

FOR i:=1 TO n DO FOR j:=1 TO n DO READ(b[i,j]);

FOR i:=1 TO n DO FOR j:=1 TO n DO BEGIN

c[i,j]:=0; FOR k:=1 TO n DO c[i,j]:=c[i,j]+a[i,k]*b[k,j]; END;

WRITELN(' A*B :');

FOR i:=1 TO n DO FOR j:=1 TO n DO WRITE(c[i,j]);

WRITELN;

END.

, - . :

FOR i:=1 TO n DO BEGIN

FOR j:=1 TO n DO WRITE(c[i,j]:8);

WRITELN;

END;

.

- , :

CONST a : ARRAY[1..5] OF Byte=(1,2,3,4,5);

c : ARRAY[0..3] OF Char=('a','b','c','d');

b : ARRAY[-1..1] OF Boolean=(FALSE,TRUE,FALSE);

:

CONST c : ARRAY[0..3] OF Char='abcd';

, , , :

CONST A : ARRAY[1..3,1..2] OF Real = ((0,1),(2,4),(3,5));

, , , ARRAY[1..3,1..2] OF Real ARRAY[1..3] OF ARRAY[1..2] OF Real.

, , , , , , - . , , , .


.. - (, - ShortInt, Byte, Integer, Word, LongInt, Char Boolean). , ,

 

 

 

! , , , .
. , :