欣乐

The eagles are coming!

导航

p73 用异或运算反转特定位

//73
program test;
var 
  i,j,k:byte;
begin
  i:=%00001111;
  for j:=0 to 9 do begin
    k:=i xor j; //j的低四位被反转
    writeln( binstr(j,8) );
    writeln( binstr(k,8) ); //方便观察输出、对比
    writeln;
  end;
end.

 

posted on 2014-09-19 11:37  欣乐  阅读(168)  评论(0编辑  收藏  举报