Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
4
Добавлен:
14.02.2016
Размер:
1.37 Mб
Скачать

 

101

, .

31

: -

. .

. -

. .

: -

.

-

, -, .

.

, ,

:

1..

2., .

3..

- ,

.

.

( ) - ,

.

: -

.

( , -

.). .

. -

( ) -

( ) .

( ) ,

Program Procedure Function.

Procedure );

; Begin

; End;

Function ): ;

;

102 .

., .

Begin

; End;

,

-

.

:

:= ;

(

) .

:

Procedure Geron(a,b,c: real);

Function factorial(n:integer):integer; Procedure P2(a,d:real,c:integer,f:char);

) -

( ).

:

Procedure Geron(3.5,4.2,6); Function factorial(10); Procedure P2(-4,2.3,11,’X’);

- :

-

, .

-:

;

;

max1/3;

min3;

.

-:

Program Z7_2;

var x1,y1,z1,min1,max1:real;

Procedure M(x,y,z:real;var min,max:real);

{ } begin

max:=x;

if max<y then max:=y; if max<z then max:=z; min:=x;

if min>y then min:=y; if min>z then min:=z;

end;

 

103

, .

Function M1(max2:real):real; begin

M1:=exp(1/3*ln(max2));

end;

Function M2(min2:real):real; begin

M2:=exp(3*ln(min2));

end; BEGIN

read(x1,y1,z1);

M(x1,y1,z1,min1,max1);

M1(min1);

M2(max1); writeln(min1,’ ‘max1); writeln(M1,’ ‘M2);

END.

3. . .

.

TurboPascal

:

9

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

) :

 

y

 

 

tgx 2

 

; Tan

 

tg.

 

 

 

 

 

 

tg 2 x 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

) : y

 

 

 

 

 

; Tan

 

tgx 2

 

tg.

 

 

 

tg 2 x 1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

; Ctg

 

)

y

ctg 2 x 2

 

 

x

1

 

 

 

 

 

 

 

 

 

 

 

 

 

tg.

 

 

 

ctgx 2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

) y

 

ctg 2 x 2

; Ctg

 

x

 

 

 

1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

ctg.

 

 

 

ctgx 2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2z 4x

 

 

 

 

 

 

 

 

) y

z 2 , z=x2-4x.

 

 

 

 

 

 

z 2

 

 

 

 

 

 

 

 

t1

– z.

) y 2z 4x z2 , z=x2-4x.

z 2

t1 – z.

104

.

 

., .

12

10

1. ,

-

. .

11

1., -

, -

. ,

.

1.. ,

-

,

.

4. : .4, §1, .2 " ". . ,

. , .

5. . . -

.

 

105

, .

32

: ,

-

.

.

: , -

,

-

.

-

.

, .

, .

:

1..

2..

.

.

.

3., .

4..

) .

,

,

, .

) .

:

IF THEN 1( ) ELSE 2( );

: -

1( ) 2( ).

, -

True ( ) False.

( ):

IF THEN );

, -

False , .

Then Else -

- Begin i End.

106

.

 

., .

-

:

.

Program Maximum;

var a,b,c:real;

}

max:real;

}

Begin writeln(‘ ’);

readln(a,b,c);

}

if a>b

}

then max :=a

 

else max:=b;

max}

if max<c

then max:=c;

max }

writeln(‘max=‘,max)

End.

 

.

-

, -, And (i), Or ), Not ). .

:

IF (a=b) and (a+c>r) THEN ....

( Goto ).

, . -

,

:

Goto ;

. -, . Label.

:

K1 : c:=c+2;

if c<10 then Goto K1;

( ase).

,

. -

, -

.

 

107

, .

:

CASE OF

1 : 1;

2 : 2;

...........................

N : N

ELSE

ND;

Case i Of

( , ).

- , -

.

.

:

, -

. ,

Else.

:

,

.

Program KVARTAL; Var M: integer;

Begin readln(M);

Case M div 3 of

0: write(‘1 ’);

1: write(‘2 ’);

2: write(‘3 ’);

3: write(‘4 ’) end

End.

 

 

 

 

 

 

3. .

.

.

 

 

 

 

 

TurboPascal

 

:

 

 

 

 

 

 

:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1

Y = {

 

at2ln(t)

 

1 t 2

 

 

 

 

1

 

t < 1

 

 

 

 

eatcos(bt)

 

t > 2

 

108

 

.

 

 

 

., .

 

 

 

 

 

 

 

 

2

Y = {

x2-7/x2

X < 1,3

 

 

 

ax + 7

X = 1,3

 

 

 

lg( + 9)

X > 1,3

 

 

3

Y = {

2 + b +

X < 1,2

 

 

 

/ + 7 2 + 1)

X = 1,2

 

 

 

+ bx) / + 1

X > 1,2

 

 

4

Y = {

2 + 6 / ( + 1)

X < 1,4

 

 

 

bx2 - 8

X = 1,4

 

 

 

lg( + 2b)

X > 1,4

 

 

5

Y = {

1.5 Cos2 + 5

X < 2

 

 

 

1.8 + tg a

X = 2

 

 

 

– 2)2 + 6

X > 2

 

 

6

Y = {

– )

X < a

 

 

 

Sin( )

X = a

 

 

 

e Cos (ax)

X > a

 

 

7

Y = {

– lg(bx)

X < 1

 

 

 

l

X = 1

 

 

 

bx + lg(x)

X > 1

 

 

8

Y = {

(5x2 + 1) / x + t

X < 0,5

 

 

 

x + t + 1 / x

X = 0,5

 

 

 

Cos(x) + tx2

X > 0,5

4. : .5, §2.3, 2.5, .2 " ". . -

, . , .

5. . .

 

109

, .

33

:

-

. -

.

: -

-

.

.

, .

:

1..

2..

:

-;

-;

-.

3., .

4..

.

-

. -

- ,

), . TurboPascal

, While ( ), Repeat

), For ( ).

1.1 (While).

:

WHILE DO ;

WHILE DO BEGIN

;

...............;

; END;

110

.

 

., .

: ).

. -

. .

False ( ) .

True ( ) -

Do, -

. -

, -

True, ( -

).

. 1. 0 100.

Program SUMMA;

var i,s: integer;

Begin

 

s:=0;

{ i }

i:=2;

While i<= 100 do

begin

 

s:=s+i;

{ . }

i:=i+2;

end;

write(‘S=‘,s)

End.

1.2 (Repeat).

:

REPEAT

);

UNTIL ;

: ) ,

(True). , -

True, False,

While. ,

, .

False .

Repeat ,

, , ,

, . -

( -

- , - ).

.

Соседние файлы в папке Інфогматика