(1)加减法:a=a+b;b=a-b;a=a-b;
(2)乘除法:a=a*b;b=a/b;a=a/b;
(3)异或运算:a=a^b;b=a^b;a=a^b;(遇到a可翻译b,遇到b可翻译a)
^异或(按位异或):相同出0,相异出1.
如:2 0000 0000 0000 0010
3 0000 0000 0000 0011
2^3 0000 0000 0000 0001 =1
2^3^2 0000 0000 0000 0011=3
--加减运算
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 0;
int b = 0;
scanf("%d", &a);
scanf("%d", &b);
a = a +b;
b = a-b;
a = a-b;
printf("%d\n",a);
printf("%d\n", b);
system("pause");
return 0;
}
--乘除运算
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 0;
int b = 0;
scanf("%d", &a);
scanf("%d", &b);
a = a * b;
b = a /b;
a = a / b;
printf("%d\n", a);
printf("%d\n", b);
system("pause");
return 0;
}
--异或运算
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a = 0;
int b = 0;
scanf("%d", &a);
scanf("%d", &b);
a = a^b;
b = a ^ b;
a = a ^ b;
printf("%d\n", a);
printf("%d\n", b);
system("pause");
return 0;
}