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

2 ЛР 3

.pdf
Скачиваний:
27
Добавлен:
08.06.2015
Размер:
184.83 Кб
Скачать

3

: -

.

-

, -.

, ,

.

-

( ), -

.

-

, , ,

.

-

, .

-

. -

,

,

. 1).

( )

. 1.

, -

,

.

1

: READ, READLN, WRITE, WRITELN.

: SIN, COS, ORD.

,

-

, .

.

, , -

.

, . -

( . 2).

-

, ,

. , ,

, . « » .

, ( . 2) -

, . -

, -

, – , ,

. , ,

-

.

1

2

21

22

B

. 2.

,

.

2

, -

: ,, , , .

, , 21 -

, , , -

2, . ,

, – .

, -

. -

.

,

( . 2) (

).

, ,

. , -

« » . -

– .

:

PROCEDURE < > [(< . . .>)];

:

FUNCTION < > [(< . . .>)]: < >;

< > – ; < . . .> – ;

< > – .

). ,

, : procedure SB (a: real; b: integer; c: char);

-

, ,

function F (a: real; b: real): real;

: function F (a, b: real): real;

: -

3

-

.

. . ( a x exln a )

var

x,y: real;

function power( a, b: real): real; begin

if a>0 then power := exp(b*ln(a)) else power := 0;

end; {function power}

begin repeat

readln(x,y);

writeln( power(x,y) ); until false;

end.

power -

writeln. x y -

– .

a b , -

. -

– -

.

,

-

.

, -

.

.

, .

a b .

, -

var,

function power( var a: real, b: real): real;

,

, -

.

, -

4

, . -

,

,

-

.

,

, -

.

power(x, 3*sin(x));

 

power(x, 3.17);

. var

a, b: integer;

procedure inc2( var c: integer; b: integer ); begin

c := c + c; b := b+b; writeln(‘ :’, c:5, b:5); end;

begin

a := 5; b := 7; writeln(‘ :’, a:5, b:5); inc2(a,b);

writeln(‘ : ’, a:5, b:5); end.

:

:

5

7

:

10

14

:

10

7

,

, « »:

. -

, -

, , , -

.

-: -

, .

! -

, -

-

5

.

-

.

, -

.

, .

1. , -

. x.

, .

 

2x 4,

 

npu x 2

1.1.

 

 

 

 

2

, npu 2 x 2

y(x) (x 2)

 

 

 

 

 

x,

 

 

npu x 2

 

18

 

 

 

e x ,

npu x 1

1.2.

 

 

 

npu 1 x 2

y(x) e1 ,

 

 

cos(x),

 

npu x 2

 

 

 

 

 

 

 

 

 

12,

npu x 4

1.3.

 

2

4,

 

 

npu 4 x 2

y(x) x

 

 

 

 

 

 

6,

 

 

npu x 2

 

3x

 

 

 

x3 ,

 

npu x 1

1.4.

 

 

 

 

 

 

 

y(x) cos( x), npu 1 x 0

 

 

 

 

npu x 0

 

3x,

 

x 1,

 

npu x 1

1.5.

 

 

 

 

 

 

npu 1 x 2.71

y(x) ln(x),

 

 

 

 

x,

 

npu x 2.71

 

1

 

 

1,

npu x 0

1.6.

 

 

 

 

 

 

npu 0 x 2

y(x) sin( x),

 

 

 

 

 

 

npu x 2

 

x,

 

6

 

x 2 ,

 

 

 

npu x 1

1.7.

 

 

 

npu 1 x 3

y(x) 1,

 

 

 

 

2x,

npu x 3

 

8

 

x2 ,

 

 

 

npu x 5

1.8.

 

 

x,

npu 5 x 30

y(x) 30

 

 

 

 

npu x 30

 

0,

 

 

x3 ,

 

 

 

npu x 3

1.9.

 

 

cos( x),

npu 3 x 0

y(x) 27

 

 

 

x,

npu x 0

 

27

 

2x 4,

npu x 2

1.10.

 

x

2

,

npu 2 x 5

y(x) 4

 

 

 

 

26,

npu x 5

 

x

 

sin( x),

npu x 2

1.11.

 

 

 

 

 

 

 

 

 

npu 2 x 5

y(x) 8 2x 2 ,

 

 

 

 

26,

npu x 5

 

2x

 

2x,

 

 

 

npu x 4

1.12.

 

 

 

 

 

npu 4 x 3

y(x) 8,

 

 

 

 

 

 

 

2

,

 

 

npu x 3

 

2x

 

 

 

2. , i -

. -

(i>0).

2.1.

ai = 2 ai–2 + ai–1,

i = 1, 2, 3, …;

a1=1, a2=1.

2.2.

ai = (ai–2

+ ai–1) / 3,

i = 1, 2, 3, …;

a1=1, a2=1.

2.3.

ai = ai–2 / 5 + ai–1,

i = 1, 2, 3, …;

a1=1, a2=1.

2.4.

ai = (ai–2

+ ai–1) 2,

i = 1, 2, 3, …;

a1=1, a2=1.

2.5.

ai = ai–2 / 7 – ai–1,

i = 1, 2, 3, …; a1=56, a2=1.

2.6.

ai = (ai–2

ai–1) 2,

i = 1, 2, 3, …;

a1=3, a2=1.

2.7.

ai = (ai–2

ai–1) / 2,

i = 1, 2, 3, …;

a1=5, a2=1.

2.8.

ai = 3 ai–2 2 ai–1, i = 1, 2, 3, …; a1=2, a2=1.

2.9.

ai = (2 ai–2 + ai–1)

/ 3, i = 1, 2, 3, …; a1=2, a2=1.

7

2.10.

ai = ai–2

/ 4 + 2 ai–1 ,

i = 1, 2, 3, …;

a1=16, a2=1.

2.11.

ai = ai–1

– 1 + 4 ai–1,

i = 1, 2, 3, …;

a1=3, a2=5.

2.12.

ai = -ai–2 /2 + ai–1 ,

i = 1, 2, 3, …;

a1=2, a2=4.

3., .2,

n .

4.,

( -

( char)). , -

-

, .

4.1.

00001

4.2.

10000

 

00011

 

11100

 

00111

 

11111

 

01111

 

11100

 

11111

 

10000

 

 

 

 

4.3.

100000000

4.4.

00001

 

001000000

 

00010

 

000010000

 

00100

 

000000100

 

01000

 

000000001

 

10000

 

 

 

 

4.5.

10000

4.6.

00000000

 

11100

 

00000011

 

11111

 

00001111

 

00111

 

00111111

 

00001

 

11111111

 

 

 

 

4.7.

10000

4.8.

00000

 

01000

 

00001

 

00100

 

00011

 

00010

 

00111

 

00001

 

01111

 

 

 

 

4.9.

10000

4.10.

00001

 

11000

 

00111

 

11100

 

11111

 

11110

 

00111

 

11111

 

00001

 

 

 

 

4.11.

000000011

4.12.

110000000

 

000001110

 

011100000

 

000111000

 

000111000

 

011100000

 

000001110

 

110000000

 

000000011

8

9