.


:




:

































 

 

 

 


ѳ




- ѳ .

 

, ѳ:

< >::= < >|< >|

< >

<>::=< >|< >

 

 

)

 

:

< >::= begin{<>}2end;

ѳ:

< >::={{<>}2}

 

) ( )

 

:

< >::=if< >then<>

 

:

 

if flag = true then { flag }

begin

iA:= iA + 10; { iA }

flag:= false;

end;

ѳ:

< >::=if (< >)<>

< >::=<>< ><>

:

 

if (flag == 1) // flag

{

iA = iA + 10;

flag = 0;

}

 

 

) ( )

:

< >::=if< >then<>else<>

:

 

if flag = true

iA:= iA * 10;

else

begin

iA:= iA + 10;

flag:= true;

end;

ѳ:

< >::=if (< >)<>;else<>

 

:

 

if (flag == 1)

{

iA = iA * 10;

flag = 0;

};

else

{

iA = iA + 10;

flag = 1;

}

) ( /)

:

< >::=case< >of{< >}0

{else<>}01 end

< >::={< {..<>}0 {,}0 }1: <>

 

:

 

case cB of { cB }

A: iA:= iA +10;

B, C: iA:= iA +20;

D: iA:= iA +30;

else iA:= iA +100;

end;

ѳ:

< >::=switch (< >){{ case< > }1

{default: <>}01 }

< >::=<R - >: <> break;

 

:

 

switch cB

{

case A: {iA = iA +10; break;}

case B: {iA = iA +20; break;}

case C: {iA = iA +30; break;}

default: iA = iA +100;

}

 

) ( repeat-until / do-while)

:

< >::=repeat <>until< >

 

:

 

iMounth:= 1; { iMounth }

repeat { iAccount }

iAccount:= iAccount + iAccount/100;

iMounth:= iMounth + 1;

until iMounth<=12;

ѳ:

< >::=do<>while(< >)

 

:

 

iMounth = 1;

do

{

iAccount = iAccount + iAccount/100;

iMounth = iMounth + 1;

}

while (iMounth<=12);

 

 

) ( while-do)

:

< >::=while< >do<>

:

 

iMounth:= 1;

while iMounth <= 12 do

begin

iAccount:= iAccount + iAccount / 100;

iMounth:= iMounth + 1;

end;

ѳ:

< >::=while(< >)<>

 

:

 

iMounth = 1;

while (iMounth <= 12)

{

iAccount = iAccount + iAccount/100;

iMounth = iMounth + 1;

}

 

 

) ( for-step-do)

:

< >::=for < >to|downto

<> {step<> }01do<>

 

:

 

for iMounth:= 1 to 12 do

begin

iAccount:= iAccount + iAccount / 100;

if iMounth > 6 then

iAccount:= iAccount + iAccount * 0.05;

end;

ѳ:

< >::=for ({< >}01;

{< >}01;{< >}01){<>}01

:

 

for (iMounth = 1; iMounth <= 12; iMounth = iMounth + 1)

{

iAccount = iAccount + iAccount / 100;

if (iMounth > 6)

iAccount = iAccount + iAccount * 0.05;

}

 

, , , .

then else , , .

( ) .

() , .

, , .

.

, .

, ().

, ' .

 

1. ( ) ѳ: , .

2. ѳ, .

4. ѳ, (.18). .

18

  ˳ 1       -25
ѳ >        
    -7  
  ˳ 1       -37
ѳ = =     -8  
       
  <     -77  
    -77  
ѳ +   -10    
       
  >        
       
ѳ ˳ 1     -18  
  = =        
    -2  
ѳ ˳ 1   -255    
  +   -52    
       
ѳ <   -2    
       
  ˳ 1   -87    
ѳ <     -8  
       
  ˳ 1   -24    
ѳ >        
  -7    
  <     -6  
    -10  
ѳ ˳ 1   -128    
  >   -1    
  -12    
ѳ ˳ 1     -15  
  =   -57    
  -57 -10  
ѳ +       -3
       
  +     -12  
       
ѳ =   -21    
  -21    
  ˳ 1   -43    
ѳ =        
       
  ˳ 1   -92    
ѳ <        
       
  >        
       
ѳ +        
  -73    

 

:

- ();

- 0 1 .

, , .

n- (sizeof( ) >= n >= 0) , 1, . , iA :

iBitA:= iA and (1 shl 5) () iBitA = iA & (1 << 5) (ѳ).

iBitA 0, iA 0, , 1.

, , , , .

:

= =

 

iA = 2510 = 1 10012 iBitA = iA and (1 shl 4) = 16 => 1 => 1<>0 => iA<>iB
iB = 910 = 0 10012 iBitB = iB and (1 shl 4) = 0 => 0

 

, , . , λ, , ົ:

:

+

 

iA = 2510 = 110012

iB = 910 = 010012

iSum = 3410 = 1 000 1 02

 

iSum 1 , :

1) iSum = 0, iSum = 010 = 02

2) iSum = iSum or (1 shl 1), iSum = 210 = 000 1 02

3) iSum = iSum or (1 shl 5), iSum = 3410 = 1 000 1 02

 

˳, . .

, , 0, , , 1, , . , ົ.

:

˳ 1

 

iA = 2510 = 110012

iA 1 = 2410 = 1100 0 2

 

1) iA = iA xor (1 shl 0), iA = 2410 = 1100 0 2

 

 

iA = 2410 = 110002

iA 1 = 2310 = 1 0111 2

 

1) iA = iA xor (1 shl 0), iA = 2510 = 1100 1 2

2) iA = iA xor (1 shl 1), iA = 2710 = 110 1 12

3) iA = iA xor (1 shl 2), iA = 3110 = 11 1 112

4) iA = iA xor (1 shl 3), iA = 2310 = 1 0 1112

19

+ - = > < +
                       

1 , ?

2 , , , ?

3 , ?

4 .

5 .

6 .

7 ?

8 , ?

9 .

10 ?

11 ?

 

˳: [1]; [3]; [6]; [7].

 





:


: 2016-12-18; !; : 431 |


:

:

, ,
==> ...

1642 - | 1562 -


© 2015-2024 lektsii.org - -

: 0.042 .