用位运算表示加法,但正负相加出了点问题,求教
#include<stdio.h>main()
{
int a,b,c;
int plus(int x,int y);
printf("please input two numbers a,b:");
scanf("%d,%d",&a,&b);
c=plus(a,b);
printf("%d\n",c);
}
int plus(int x,int y)
{
int z,w;
z=x&y;w=x^y;
z<<=1;
for(;z&w!=0;z<<=1)
w=z^w;
w=z^w;
return(w);
}