如何进行移位运算 如何进行移位运算 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 int a=0x12345678;a=a>>4;//向右移动四位a=a<<4;//向左移动四位 运算符: >> <<int a=0x01;a=a<<2;//a==4a=a>>1;//a==2 给你看看MSDN中的例子Example// expre_Shift_Operators.cpp// compile with: /EHsc// Demonstrate shift operators#include <iostream>using namespace std;void main() { cout << "5 times 2 is " << (5 << 1) << endl << "20 divided by 4 is " << (20 >> 2) << endl;}以后在问的时候最好先自己找找! 例如:int a=1;a<<2;左移2位a>>3;右移动3位 关于自绘问题? visual studio 2008 建立activex工程如何设置生成的安装文件不用.net??? 问:主窗体和子窗体有什么区别? 指针的传递是怎么样的?? ActiveX控件自动下载并注册的问题 当鼠标在对话框上的只读编辑框中拖动时,会触发什么消息,在MFC的程序中如何将此消息屏蔽掉 link的时候出错了,来看看是怎么回事? 请问:怎样才能弹出一个默认的属性单对话框? libnids怎么也抓不到包啊? VC++6.0与VS2008 ★★★简单问题:帮帮忙 关于VC中头文件或.lib文件包含的路径问题 如何获得IE的临时文件夹目录?
a=a>>4;//向右移动四位
a=a<<4;//向左移动四位
int a=0x01;
a=a<<2;//a==4
a=a>>1;//a==2
Example
// expre_Shift_Operators.cpp
// compile with: /EHsc
// Demonstrate shift operators
#include <iostream>
using namespace std;void main() {
cout << "5 times 2 is " << (5 << 1) << endl
<< "20 divided by 4 is " << (20 >> 2) << endl;
}以后在问的时候最好先自己找找!
int a=1;
a<<2;左移2位
a>>3;右移动3位