程序分析
二进制:0^0 = 0;0^1 = 1;1 ^ 0 = 1;1^1 = 0
源代码
#include<stdio.h>
#include<stdlib.h>
int main()
{
int a, b;
a = 077; //077是八进制,转换为二进制是111111
b = a ^ 3; //3转换为二进制是011
/* 111111
| 000011
= 111100 = 60(十进制)
*/
printf("\40:The a ^ b(decimal) is %d\n", b); //b = 60
b ^= 7; //7转换为二进制是0111
/* b = 111100
& 000111
= 111011 = 59(十进制)
*/
printf("\40:The a ^ b(decimal) is %d\n", b); //b = 59
system("pause");
return 0;
}