W wksdgy Unregistered / Unconfirmed GUEST, unregistred user! 2010-07-21 #1 已知INTEGER变量A,B ,其中 A:=1,B:=2要求写一段代码,不增加任何变量的情况下实现A=2 ,B=1如何写??
S szhcracker Unregistered / Unconfirmed GUEST, unregistred user! 2010-07-21 #3 asm mov eax, a // a(1)->eax mov edx, b mov a, edx mov b, eax pop eax pop edx end;
S smlabc Unregistered / Unconfirmed GUEST, unregistred user! 2010-07-21 #4 var a,b: Integer;begin a := 1; b := 2; PByte(PChar(@a)+1)^ := PByte(@b)^; PByte(@b)^ := PByte(@a)^; PByte(@a)^ := PByte(PChar(@a)+1)^; PByte(PChar(@a)+1)^ := 0; ShowMessage(IntToStr(a)); ShowMessage(IntToStr(b));
var a,b: Integer;begin a := 1; b := 2; PByte(PChar(@a)+1)^ := PByte(@b)^; PByte(@b)^ := PByte(@a)^; PByte(@a)^ := PByte(PChar(@a)+1)^; PByte(PChar(@a)+1)^ := 0; ShowMessage(IntToStr(a)); ShowMessage(IntToStr(b));