什么是提取操作员在做什么?我从来没有见过这种方式。请解释>>在这个程序中
void DecimalToBinary(int decimal)
{
int remainder;
if(decimal <= 1)
{
cout << decimal;
return;
}
remainder = decimal % 2;
/*----->>>*/ DecimalToBinary(decimal >> 1);/*what is the extraction operator doing?*/
cout << remainder;
}
这是一个正确的转变,不提取。 http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8l.doc%2Flanguage%2Fref%2Fbitshe.htm – Joe 2013-02-25 00:08:39
有很多关于C++的东西吸引人,而“运营商超载”可以说是其中之一。 C语言中运算符“>>”的原意是“二进制右移”:[绝对初学者移位指南](http://stackoverflow.com/questions/141525/absolute-beginners-guide-to-bit -shifting) – 2013-02-25 00:10:35