标签:
2015-09-17 10:57:12
////////////////////////////////////////////////////////////////////////// //在进行二进制移位操作时,被移位的数的字节大小,决定了移位后是否会溢出 ////////////////////////////////////////////////////////////////////////// #include <Windows.h> #include <iostream> int main() { long long number(0), number2(0); int pos(32); number|= 1<<(pos); number2|= (long long)1<<(pos); std::cout<<"num = 0x"<<std::hex<<number<<std::endl; //0x1 std::cout<<"num2 = 0x"<<std::hex<<number2<<std::endl; //0x100000000 system("pause"); return 0; }
标签:
原文地址:http://www.cnblogs.com/felove2013/p/4815668.html