c++程序设计实验报告 联系客服

发布时间 : 星期二 文章c++程序设计实验报告更新完毕开始阅读bcb347e8172ded630b1cb67d

}

return res; }

binary operator -( binary n2) {

unsigned borrow=0; int value;

binary res=\

for(int i=15; i>=0; i--) {

value=(bits[i]=='0'?0:1)-(n2.bits[i]=='0'?0:1)+borrow; res.bits[i]=(value==-1||value==1?'1':'0');

borrow=(value==-1||borrow!=0&&(value==0||value==1)?1:0); }

return res; } 2.

friend binary operator~(binary n2) {

int a=~int(n2); binary res(a); return res; }

friend binary operator&(binary n1,binary n2) {

int a=int(n2)&int(n1); binary res(a); return res; }

friend binary operator|(binary n1,binary n2) {

int a=int(n2)|int(n1); binary res(a); return res; }