. , , ,

,,,

,

:

 3  0 _______________

:

 3  0 _______________

 _ 2 ɠ

:

: . 05-204

 2

 4.


- 1 -

 2

1.

2.

3.

4.

5.

6.

7.

8.


- 2 -

 2I.

-

. -

-

.

, -

.

, -

.  

-

.

.

1101 101 ( -

).

: 1101,

1 .

1101 , -

11010 -

.

-

. ,

,


- 3 -

, .. -

, . -

-

.

. --

, -

,

-,

, .. -

-

, .

,

, -

.

 2II.

, -

, -

. -

, ,

. , -

-

, -

-

, ..

.


- 4 -

 2III.

? .

567

. -

: ,

. 9, .. 2^9=512, 2^10=1024

.

. 9+1=10.

1,

1 0. .

9

: 567-2^9=55. 2^8=256.

55 256 ,

.. 10.

: 2^7=128 > 55,

. .. 2^6=64 .

1000. 2^5=32 ,

32 < 55, 1 (

10001), 55-32=23. 2^4=16 < 23 - -

1 => 100011. 23-16=7. 2^3=8 > 7 =>

1000110. 2^2=4 < 7 => 10001101, 3. 2^1=2 <

3 => 100011011, 1. 2^0=1 = 1 => 1000110111.

.


- 5 -

567,

. .

. .. 16^2=256 < 567,

16^3=4096 > 567, 2+1=3. -

, .

1 15,

(

- ).

2, .. 256*2=512 < 567, 256*3=768 > 567.

 22 0, -

2,

蠠 砠 堠 :

0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F. 젠 :

567-2*16^2=55.

. 3*16^1=48 < 55, 4*16^1=64 > 55,

젠 堠  23 0. -

=55-3*16^1=7. : .. 16^0=1

, ..  27 0.

 2237 0, -

.

.

.

 24A3F  0 -

. (4 ) 16

4-1=3, 16^3=4096. -

, .. 4.


- 6 -

4096*4=16384.

. : 16^2=256. 256

.. A.

A F 10 15 ( A=10, B=11,

C=12, D=13, E=14, F=15). 256 10 2560

, -

16384. 18944. -

: 3*16^1=48,

18992. : 15*16^0=15.

 219007 0.

.

 2IV.

䠠 砠 頠

,

. -

,

.

,

,

-

. :

,

? -

,


- 7 -

: , ..

1 0,

,

.

: .

,

,

. -

, -

, -

, .. 堠

.

,

,

, -

-

-

.

, -

-

.

,

, .

-

, .. .


- 10 -

 2VII.

:

Program Perevod;

.

:

- Uses: TPU

( Turbo Pascal).

- Const: -

. S - -

. ,

.

- Var: .

Longint - ,

-2147483648 2147483647

32 .

Integer - , -

-32768 32767 16

.

Char - , -

.

Byte - ,

0 255 8 .

Set of '0'..'F' - ,

'0' 'F'.

Array [1..255] of Char -


- 11 -

255 .

String - ( -

1 255 ).

Zast.

, -

.

. :

Window (1,1,80,24) - -

.

ClrScr - .

TextColor (15) - -

( ).

GoToXY (x,y) - y

x.

Write ( ) - -

.

-

.

,

, -

.

-

, , -

.

. -


- 12 -

Begin.

Y 1 -

.

Zast, -

-

.

Zast -

- Repeat.

-

.

, 13,2

(  2> 0 ).

ReadKey.

,

Klav. -

.

If, -

-

.

If ,

"".  

Y ,

1, 7.

,

"".

True

ESC (). -


- 13 -

Y 7, Klav

. -

-,

.

, , Y<7, ..

. -

True,

, -

.

.

. -

, "ESC

- Ġ ".

. Stroka

( ) -

2.

Case

, -

Isx ( -

), Keys (,

) Kon (

).


- 14 -

⠠ 堠 ࠠ

- Repeat,

.

, ,

Klav. -

UpCase -

. If , -

, ,

Kol ( ) -

,

A ( ) -

.

,

. Kol

,

.

Until 䠠

- ,

ESC.

, -

. ,

, -

, -

.

1 Kol ( ).

If -

-


- 15 -

, Promeg -

Kol-1.

. -

.

.

I,

- -

(. .III.

).

I, I 0.

-

:

- Help

J ;

- If

, ;

- ,

;

- , -

Promeg.

,

.

,


- 16 -

, -

.

, WriteLn.

-,

, -

ESC. ESC -

- .

-

, "ESC - Ġ

DOS".

, -

.

 2VIII.

:


- 17 -

_____________________________________________________

| |

| > . |

| |

| . |

| |

| .|

| |

| .|

| |

| . |

| |

| . |

| |

| ESC - DOS |

| |

|_____________________________________________________|

.

.

. -

, :

ESC

.

:


- 18 -

_____________________________________________________

| |

| . |

| |

| ? 32 = 100000 |

| ? 33 = 100001 |

| ? 26 = 11010 |

| ? 500 = 111110100 |

| ? 3 = 11 |

| ? 34_ |

| |

| |

| |

| |

| |

| ESC - ޠ |

|_____________________________________________________|

, ,

.

, -

,

.

,

'1' '0', -

.


- 19 -

,

,

,

.

,

, -

.

, -

ESC ( ).

.

,

.

,

.


- 8 -

Program Perevod;

Uses Crt;

Const P1=' '; { }

s:array [1..7] of string[50]=(p1+' .',

p1+' .',

p1+' .',

p1+' .',

p1+' .',

p1+' .',

' ESC - DOS');

Var Promeg,Chast:Longint;

Znach,j:Integer;

Klav:Char;

i,Stroka,Isx,Kon,y,Kol,Help:Byte;

Keys: Set of '0'..'F';

a: Array [1..255] of Char;

Otv,Pom: string;

Procedure Zast; { }

begin

Window(1,1,80,24); { 8024 }

ClrScr; { }

TextColor(15); { - }

FOR I:=1 TO 7 do begin { }

GoToXY (15,I*2); Write (s[i]); { }

end;

end { zast }; { }

Function Stepen (Chis,St: Byte): Longint; { }

var c: Byte;

Res: longint;

begin

Res:=1;

For c:=1 to st do Res:=Res*chis;

Stepen:=Res; { }

End { Stepen }; { }

Begin { }

y:=1; { y - }

Zast; { }

Repeat { }

TextColor(13);

GoToXY (13,y*2); Write(Chr(16)); { }

klav:=ReadKey; { klav }

GoToXY (13,y*2); Write(' '); { }

if Ord(Klav)=72 then if y > 1 then y:=y-1 else y:= 7; { }

if Ord(Klav)=80 then if y < 7 then y:=y+1 else y:= 1; { }

if Ord(Klav)=27 then begin y:=7; klav:=Chr(13) end; { ESC }

if (Ord(Klav)=13) and (y<7) then begin { }

ClrScr; { }

TextCOLOR (13); GoToXY (20, 1); Write (s[y]); { }

TextCOLOR (10); GoToXY (31,24); Write ('ESC - '); { }

TextColor(15); { - }

Window(1,2,80,23); { 2 23 }

Stroka:=2; { }


- 9 -

Case y of { }

1,3 : begin { }

Isx:=10;

Keys:=['0'..'9']; { }

If y=1 Then Kon:=2 else Kon:=16; { }

end;

2,5 : begin

Isx:= 2;

Keys:=['0','1']; { }

If y=2 Then Kon:=10 else Kon:=16; { }

end;

4,6 : begin

isx:=16;

keys:=['0'..'9','A'..'F']; { }

if y=4 then kon:=10 else kon:=2; { }

end;

end;

Repeat { }

Write('? '); Promeg:=0; Kol:=0; Otv:=''; { }

Repeat { }

klav:=ReadKey; { }

if UpCase(Klav) in Keys then begin { }

kol:=kol+1; { }

a[kol]:=UpCase(Klav); { }

Write (a[kol]); { }

end;

if (Ord(Klav)=8) and (Kol>0) then begin { }

kol:=kol-1;

GoToXY(WhereX-1,WhereY);

ClrEol;

end;

Until (Ord(klav)=13) or (Ord(klav)=27); { ESC }

if Ord(klav)=13 then begin { - }

for i:=1 to kol do begin { }

if a[i]<'A' then Znach:=Ord(a[i])-48

else Znach:=Ord(a[i])-55;

promeg:=promeg+Znach*Stepen(isx,kol-i);

end;

i:=0;

Repeat { }

i:=i+1;

Chast:=Trunc(Promeg/Stepen(Kon,i));

Until Chast

For j:=i downto 0 do begin { }

Help:=Trunc(Promeg/Stepen(Kon,j));

If Help>9 Then Pom:=Chr(55+Help)

Else Str(Help,Pom);

Otv:=Otv+Pom;

Promeg:=Promeg-Help*Stepen(Kon,j);

end;

WriteLn(' = ',Otv); { }

end; { }

Until Ord(Klav)=27; { ESC }

Zast; { }

end;

Until (Ord(Klav)=13) and (y=7); { ESC }

ClrScr { }

end.

: 3 0 _______________ : 3 0 _______________

 

 

 

! , , , .
. , :