1.用汇编编写:
TITLE ...
.386
.model flat, stdcall
DumpRegs PROTO
DumpMem PROTO
ExitProcess PROTO, dwExitCode:DWORD
.data
.code
main PROC
mov eax, 1
mov ebx, 4
add eax, ebx
sub ebx, eax
neg ebx
sub eax, ebx
INVOKE DumpRegs
INVOKE ExitProcess, 0
main ENDP
END main
2.用C/C++编写:
#include <stdio.h>
int main( )
{
int a = 4;
int b = 5;
a = a ^ b;
b = b ^ a;
a = a ^ b;
printf("The variable a:%d/n", a);
printf("The variable b:%d/n", b);
return 0;
}