1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| #include <stdlib.h> #include <stdio.h>
int random(); int main() { int a = random(); int b = random(); printf("a=%d, b = %d\n", a, b); a = a ^ b; b = a ^ b; a = a ^ b; printf("a=%d, b = %d\n", a, b); getchar(); return 0; } int random() { if (1&rand()) { return rand(); } return -rand(); }
|