.


:




:

































 

 

 

 





, ( , ) , . . , ( , ; , , ).

, , (, , , ., ). char, short, int, long, .

 

~ ( , 1)
& 1 , 1
| 1 , 1
^ 1 ,

 

 

!!! , C++ , .

.

, , . true 1, false 0. , .

 

 

A

 

B

~ A & | ^
0 0 1 0 0 0
0 1 1 0 1 1
1 0 0 0 1 1
1 1 0 1 1 0

-----------------------------------------------------------------------------------------

12 & 22 4, :

1210 = 16 = 000011002 ( char)

&

2210 = 1616 = 00010110 2

000001002 = 410

-----------------------------------------------------------------------------------------

12 | 22 30, :

1210 = 16 = 000011002 ( char)

( - or) +

2210 = 1616 = 000101102

__________

000111102 = 1* 24 +1*23+ 1*22+ 1* 21 =3010;

-----------------------------------------------------------------------------------------

2 ( )

12 ^ 22 26, :

1210 = 16 = 000011002 ( char)

( ^)

2210 = 1616 = 000101102

__________

000110102 = 1* 24 +1*23+ 1* 21 =2610;

-----------------------------------------------------------------------------------------

2 << 7 256, :

210 = 00000000 000000102 ( unsigned short)

7 1 7 :

00000001 000000002 = 1 * 28 = 256;

 

256 >> 6 4, :

25610 = 00000001 000000002 ( unsigned short)

6 1 6 :

00000000 000001002 = 410;

-----------------------------------------------------------------------------------------

& :

4 char : ( & 16) == 16;

4, 2, 1 char : ( & 22) == 22;

-----------------------------------------------------------------------------------------

& :

2 char ( ) : & 251 (255 , ( & 255) , 2 4, & (255-4) 2;

-----------------------------------------------------------------------------------------

| :

2 char ( ) : | 4;

4, 2, 1, 0 char ( ) : | 23;

-----------------------------------------------------------------------------------------

Y = X & 15 Y = X & $F 4 ( char), .. $F = 15 = 00001111. , .

!!! % :

// HF() K- L- (K < L) key int HF(int key, int K, int L);{ key >>= K; // K , 0 K-1 return key % int(pow(2.0, L-K+1))// key L-K+1 }

-----------------------------------------------------------------------------------------

, . .

, . .

, , , ( , , ). , () , . , , , , (, ), .

: , , . , , , , ( ++ break) ( ++ continue).

-----------------------------------------------------------------------------------------

++:

++ :

while:

while (-)

_;

do-while:

do

_;

while (-)

for:

for (; -; )

;

( ) , , ; , ;

- ( ), ( true, .. ).

, -;

:

() -;

;

 

-----------------------------------------------------------------------------------------

while . .

while (-) . - . , , false, , .. . , , true, . , .

: , , ( , ; ). ().

, , .. - . - true ( ), , . - false, .

 

n pow_my():

 

Int pow_my (int a, int n)

{

int p=1, k=n;

while (k>0)

{p *=a; k--;}

return p;

}

 

while : while (true) ..

-----------------------------------------------------------------------------------------

do-while , while, - , , while, . , , .





:


: 2018-10-15; !; : 3093 |


:

:

- , 20 40 . - .
==> ...

1661 - | 1612 -


© 2015-2024 lektsii.org - -

: 0.029 .